Commit 58b4fba
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]>1 parent f8cd919 commit 58b4fba
1 file changed
Lines changed: 6 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
205 | | - | |
206 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
214 | 212 | | |
215 | 213 | | |
216 | 214 | | |
| |||
0 commit comments