lkml.org 
[lkml]   [2022]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] locking/local_lock: Make the empty local_lock_*() function a macro.
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

\
 
 \ /
  Last update: 2022-01-10 08:57    [W:0.045 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site