mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Waiman Long <longman@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] locking/local_lock: Make the empty local_lock_*() function a macro.
Date: Mon, 10 Jan 2022 08:43:53 +0100	[thread overview]
Message-ID: <YdvjuZATR4727gaT@linutronix.de> (raw)
In-Reply-To: <00c4c55b-7fa6-d29c-4a80-c196922ef527@redhat.com>

On 2022-01-05 22:34:31 [-0500], Waiman Long wrote:
> 
> I try out this patch and it indeed helps to reduce the object size of
> functions that use local_lock(). However, the extra code isn't an additional
> mov+add.
> 
> Using folio_add_lru() as an example,
> 
> Without the patch:
> 
> 466        local_lock(&lru_pvecs.lock);
>    0x00000000000032ee <+14>:    mov    $0x1,%edi
>    0x00000000000032f3 <+19>:    callq  0x32f8 <folio_add_lru+24>
>    0x00000000000032f8 <+24>:    callq  0x32fd <folio_add_lru+29>

The call here might be due to some debugging switches or compiler
optimisation. I have with no debug and gcc-11:
| # mm/swap.c:466:     local_lock(&lru_pvecs.lock);
|         movq    $lru_pvecs, %rbx        #, tmp135
|         movq    %rbx, %rax      # tmp135, tcp_ptr__
| #APP
| # 466 "mm/swap.c" 1
|         add %gs:this_cpu_off(%rip), %rax        # this_cpu_off, tcp_ptr__

so it is mov per-CPU variable, add per-CPU offset.

Sebastian

      reply	other threads:[~2022-01-10  7:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 20:26 Sebastian Andrzej Siewior
2022-01-06  3:34 ` Waiman Long
2022-01-10  7:43   ` Sebastian Andrzej Siewior [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YdvjuZATR4727gaT@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome