diff options
author | 2023-05-09 17:02:55 +0200 | |
---|---|---|
committer | 2023-10-10 10:14:27 +0200 | |
commit | 4fbf8b136ded943f8661cf48270482ad1f5ce7bd (patch) | |
tree | 6791e499a8533413fffe2b4d0b59f04e2aa1f8f1 /tools/perf/scripts/python/export-to-postgresql.py | |
parent | locking/atomic, xen: Use sync_try_cmpxchg() instead of sync_cmpxchg() (diff) | |
download | wireguard-linux-4fbf8b136ded943f8661cf48270482ad1f5ce7bd.tar.xz wireguard-linux-4fbf8b136ded943f8661cf48270482ad1f5ce7bd.zip |
locking/atomics: Use atomic_try_cmpxchg_release() to micro-optimize rcuref_put_slowpath()
Use atomic_try_cmpxchg() instead of atomic_cmpxchg(*ptr, old, new) == old
in rcuref_put_slowpath(). On x86 the CMPXCHG instruction returns success in the
ZF flag, so this change saves a compare after CMPXCHG. Additionaly,
the compiler reorders some code blocks to follow likely/unlikely
annotations in the atomic_try_cmpxchg() macro, improving the code from:
9a: f0 0f b1 0b lock cmpxchg %ecx,(%rbx)
9e: 83 f8 ff cmp $0xffffffff,%eax
a1: 74 04 je a7 <rcuref_put_slowpath+0x27>
a3: 31 c0 xor %eax,%eax
to:
9a: f0 0f b1 0b lock cmpxchg %ecx,(%rbx)
9e: 75 4c jne ec <rcuref_put_slowpath+0x6c>
a0: b0 01 mov $0x1,%al
No functional change intended.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul E. McKenney <paulmck@kernel.org>
Link: https://lore.kernel.org/r/20230509150255.3691-1-ubizjak@gmail.com
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions