• Uros Bizjak's avatar
    x86/percpu: Define {raw,this}_cpu_try_cmpxchg{64,128} · 54cd971c
    Uros Bizjak authored
    Define target-specific {raw,this}_cpu_try_cmpxchg64() and
    {raw,this}_cpu_try_cmpxchg128() macros. These definitions override
    the generic fallback definitions and enable target-specific
    optimized implementations.
    
    Several places in mm/slub.o improve from e.g.:
    
        53bc:	48 8d 4f 40          	lea    0x40(%rdi),%rcx
        53c0:	48 89 fa             	mov    %rdi,%rdx
        53c3:	49 8b 5c 05 00       	mov    0x0(%r13,%rax,1),%rbx
        53c8:	4c 89 e8             	mov    %r13,%rax
        53cb:	49 8d 30             	lea    (%r8),%rsi
        53ce:	e8 00 00 00 00       	call   53d3 <...>
    			53cf: R_X86_64_PLT32	this_cpu_cmpxchg16b_emu-0x4
        53d3:	48 31 d7             	xor    %rdx,%rdi
        53d6:	4c 31 e8             	xor    %r13,%rax
        53d9:	48 09 c7             	or     %rax,%rdi
        53dc:	75 ae                	jne    538c <...>
    
    to:
    
        53bc:	48 8d 4a 40          	lea    0x40(%rdx),%rcx
        53c0:	49 8b 1c 07          	mov    (%r15,%rax,1),%rbx
        53c4:	4c 89 f8             	mov    %r15,%rax
        53c7:	48 8d 37             	lea    (%rdi),%rsi
        53ca:	e8 00 00 00 00       	call   53cf <...>
    			53cb: R_X86_64_PLT32	this_cpu_cmpxchg16b_emu-0x4
        53cf:	75 bb                	jne    538c <...>
    
    reducing the size of mm/slub.o by 80 bytes:
    
       text    data     bss     dec     hex filename
      39758    5337    4208   49303    c097 slub-new.o
      39838    5337    4208   49383    c0e7 slub-old.o
    Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20230906185941.53527-1-ubizjak@gmail.com
    54cd971c
percpu.h 19.2 KB