Commit 28fd85a
perf/core: Use local64_try_cmpxchg in perf_swevent_set_period
Use local64_try_cmpxchg instead of local64_cmpxchg (*ptr, old, new) == old
in perf_swevent_set_period. 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, try_cmpxchg implicitly assigns old *ptr value to "old" when cmpxchg
fails. There is no need to re-read the value in the loop.
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/20230708081129.45915-1-ubizjak@gmail.com1 parent 4c1c9de commit 28fd85a
1 file changed
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9595 | 9595 | | |
9596 | 9596 | | |
9597 | 9597 | | |
9598 | | - | |
9599 | | - | |
9600 | | - | |
9601 | | - | |
| 9598 | + | |
| 9599 | + | |
| 9600 | + | |
| 9601 | + | |
| 9602 | + | |
9602 | 9603 | | |
9603 | | - | |
9604 | | - | |
9605 | | - | |
9606 | | - | |
9607 | | - | |
| 9604 | + | |
| 9605 | + | |
| 9606 | + | |
| 9607 | + | |
9608 | 9608 | | |
9609 | 9609 | | |
9610 | 9610 | | |
| |||
0 commit comments