On Tue, Apr 19, 2022 at 5:39 PM Yu Zhao <yuzhao@xxxxxxxxxx> wrote: > > A related question: if I pass new = old to try_cmpxchg(), does it know > that and avoid an unnecessary atomic op? No. try_cmpxchg() basically translates directly to a cmpxchg instruction (on x86) with the return value being the eflags 'Z' bit. Linus