diff options
| author | Uros Bizjak <[email protected]> | 2022-07-14 19:16:53 +0200 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2022-09-11 21:55:07 -0700 |
| commit | b0192296b45232872720d969366449c001ab1f4a (patch) | |
| tree | e4c722c8935747ded01af079f6e1c8302264c2b5 /tools/perf/scripts/python/bin/stackcollapse-report | |
| parent | 693fc06e98514c2d5951ead4aca40cf8b21100b1 (diff) | |
buffer: use try_cmpxchg in discard_buffer
Use try_cmpxchg instead of cmpxchg (*ptr, old, new) == old in
discard_buffer. 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, enabling further code simplifications.
Note that the value from *ptr should be read using READ_ONCE to prevent
the compiler from merging, refetching or reordering the read.
No functional change intended.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Uros Bizjak <[email protected]>
Cc: Alexander Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-report')
0 files changed, 0 insertions, 0 deletions