posix-timers: Use atomic64_try_cmpxchg() in __update_gt_cputime()
authorUros Bizjak <ubizjak@gmail.com>
Mon, 16 Jan 2023 16:53:37 +0000 (17:53 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 6 Feb 2023 13:22:09 +0000 (14:22 +0100)
commit915d4ad3830aa1a2dafda9b737749fb410cb9790
treee8287c524625634c219ad3dc4e553a1d429bdcec
parentcbdb1f163af2bb90d01be1f0263df1d8d5c9d9d3
posix-timers: Use atomic64_try_cmpxchg() in __update_gt_cputime()

Use atomic64_try_cmpxchg() instead of atomic64_cmpxchg() in
__update_gt_cputime(). The 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, atomic64_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: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20230116165337.5810-1-ubizjak@gmail.com
kernel/time/posix-cpu-timers.c