diff options
| author | Uros Bizjak <[email protected]> | 2024-09-23 12:22:17 +0000 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2024-10-07 06:00:11 +0000 |
| commit | 20195d011c840b01fa91a85ebcd099ca95fbf8fc (patch) | |
| tree | 1e9f0af89a9089da333eb0e353eb775fe35772bb /rust/helpers/err.c | |
| parent | xfs: scrub: convert comma to semicolon (diff) | |
| download | kernel-20195d011c840b01fa91a85ebcd099ca95fbf8fc.tar.gz kernel-20195d011c840b01fa91a85ebcd099ca95fbf8fc.zip | |
xfs: Use try_cmpxchg() in xlog_cil_insert_pcp_aggregate()
Use !try_cmpxchg instead of cmpxchg (*ptr, old, new) != old in
xlog_cil_insert_pcp_aggregate(). x86 CMPXCHG instruction returns
success in ZF flag, so this change saves a compare after 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.
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.
Signed-off-by: Uros Bizjak <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Cc: Chandan Babu R <[email protected]>
Cc: Darrick J. Wong <[email protected]>
Reviewed-by: Dave Chinner <[email protected]>
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'rust/helpers/err.c')
0 files changed, 0 insertions, 0 deletions
