• Uros Bizjak's avatar
    io_uring: Use atomic_long_try_cmpxchg in __io_account_mem · 4ccc6db0
    Uros Bizjak authored
    Use atomic_long_try_cmpxchg instead of
    atomic_long_cmpxchg (*ptr, old, new) == old in __io_account_mem.
    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.
    Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Pavel Begunkov <asml.silence@gmail.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    4ccc6db0
rsrc.c 31.5 KB