diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2022-10-19 16:08:50 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2022-10-27 10:35:41 +0200 |
commit | d0c006402e7941558e5283ae434e2847c7999378 (patch) | |
tree | b55cbec0a50b075fd546c6713d83d65f8b67d290 /kernel/profile.c | |
parent | 247f34f7b80357943234f93f247a1ae6b6c3a740 (diff) | |
download | linux-d0c006402e7941558e5283ae434e2847c7999378.tar.bz2 |
jump_label: Use atomic_try_cmpxchg() in static_key_slow_inc_cpuslocked()
Use atomic_try_cmpxchg() instead of atomic_cmpxchg (*ptr, old, new) ==
old in static_key_slow_inc_cpuslocked(). x86 CMPXCHG instruction
returns success in ZF flag, so this change saves a compare after
cmpxchg (and related move instruction in front of cmpxchg).
Also, atomic_try_cmpxchg() implicitly assigns old *ptr value to "old" when
cmpxchg fails, enabling further code simplifications.
No functional change intended.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20221019140850.3395-1-ubizjak@gmail.com
Diffstat (limited to 'kernel/profile.c')
0 files changed, 0 insertions, 0 deletions