Files
linux/kernel
Uros Bizjak 58b4fba81a ucount: use atomic_long_try_cmpxchg() in atomic_long_inc_below()
Use atomic_long_try_cmpxchg() instead of
atomic_long_cmpxchg (*ptr, old, new) == old in atomic_long_inc_below().
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_long_try_cmpxchg implicitly assigns old *ptr value to "old"
when cmpxchg fails, enabling further code simplifications.

No functional change intended.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Uros Bizjak <[email protected]>
Reviewed-by: Alexey Gladkov <[email protected]>
Cc: Sebastian Andrzej Siewior <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Cc: Alexey Gladkov <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: MengEn Sun <[email protected]>
Cc: "Thomas Weißschuh" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
2025-08-02 12:01:38 -07:00
..
…
…
…
…
…
…
…
…
…
2025-05-06 13:59:00 +02:00
…
…
…
…
…
…
…
2024-11-03 01:28:06 -05:00
…
…
…
…
2025-02-12 12:12:27 +01:00
…