Re: [PATCH] sched/clock: Use try_cmpxchg64 in sched_clock_{local,remote}

From: Peter Zijlstra
Date: Thu May 19 2022 - 03:48:09 EST


On Wed, May 18, 2022 at 08:49:53PM +0200, Uros Bizjak wrote:
> Use try_cmpxchg64 instead of cmpxchg64 (*ptr, old, new) != old in
> sched_clock_{local,remote}. x86 cmpxchg returns success in ZF flag,
> so this change saves a compare after cmpxchg (and related move
> instruction in front of cmpxchg).
>
> Signed-off-by: Uros Bizjak <ubizjak@xxxxxxxxx>

Thanks!