Re: [PATCH v10 05/14] mm: multi-gen LRU: groundwork
From: Linus Torvalds
Date: Wed Apr 20 2022 - 16:08:05 EST
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