diff options
author | Uros Bizjak <[email protected]> | 2024-05-22 10:26:49 +0200 |
---|---|---|
committer | Joerg Roedel <[email protected]> | 2024-06-25 14:21:10 +0200 |
commit | b95a40122a8183873736e0506df8e3a881178099 (patch) | |
tree | 261ca382465877f76dae4ec35677440fd0d4e5d4 /lib/test_fortify/write_overflow-strscpy.c | |
parent | c94ad1d5e3885bd4fa6abb695baf5a8f5c3c309c (diff) |
iommufd: Use atomic_long_try_cmpxchg() in incr_user_locked_vm()
Use atomic_long_try_cmpxchg() instead of
atomic_long_cmpxchg (*ptr, old, new) != old in incr_user_locked_vm().
cmpxchg 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. There is no need to re-read
the value in the loop.
Signed-off-by: Uros Bizjak <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: Kevin Tian <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Robin Murphy <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Joerg Roedel <[email protected]>
Diffstat (limited to 'lib/test_fortify/write_overflow-strscpy.c')
0 files changed, 0 insertions, 0 deletions