x86/percpu: Convert this_percpu_xchg_op() from asm() to C code, to generate better...
authorUros Bizjak <ubizjak@gmail.com>
Wed, 20 Mar 2024 08:30:40 +0000 (09:30 +0100)
committerIngo Molnar <mingo@kernel.org>
Wed, 20 Mar 2024 11:29:02 +0000 (12:29 +0100)
commit0539084639f3835c8d0b798e6659ec14a266b4f1
treec66aeefb14e9a55ffafde12f48f0873e1c1c9856
parent4ae3dc83b047d51485cce1a72be277a110d77c91
x86/percpu: Convert this_percpu_xchg_op() from asm() to C code, to generate better code

Rewrite percpu_xchg_op() using generic percpu primitives instead
of using asm. The new implementation is similar to local_xchg() and
allows the compiler to perform various optimizations: e.g. the
compiler is able to create fast path through the loop, according
to likely/unlikely annotations in percpu_try_cmpxchg_op().

No functional changes intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20240320083127.493250-1-ubizjak@gmail.com
arch/x86/include/asm/percpu.h