x86/smp: Use atomic_try_cmpxchg in native_stop_other_cpus()
authorUros Bizjak <ubizjak@gmail.com>
Thu, 23 Nov 2023 20:34:23 +0000 (21:34 +0100)
committerIngo Molnar <mingo@kernel.org>
Thu, 30 Nov 2023 19:25:09 +0000 (20:25 +0100)
commit9e9d673b2c84719937db5d6ab1d8cbcd7d45e974
treea258dea9e23cb10d51a214f04b4d03ef019aa0dc
parent9d1c8f21533729b6ead531b676fa7d327cf00819
x86/smp: Use atomic_try_cmpxchg in native_stop_other_cpus()

Use atomic_try_cmpxchg() instead of atomic_cmpxchg(*ptr, old, new) == old.

X86 CMPXCHG instruction returns success in ZF flag, so this change saves a
compare after the CMPXCHG.

Tested by building a native Fedora-38 kernel and rebooting
a 12-way SMP system using "shutdown -r" command some 100 times.

No functional change intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20231123203605.3474745-2-ubizjak@gmail.com
arch/x86/kernel/smp.c