Re: [PATCH] Documentation/atomic_t: Document cmpxchg() vs try_cmpxchg()

From: Will Deacon
Date: Mon Jul 05 2021 - 11:21:43 EST


On Mon, Jul 05, 2021 at 05:07:41PM +0200, Peter Zijlstra wrote:
> On Mon, Jul 05, 2021 at 04:00:01PM +0200, Peter Zijlstra wrote:
>
> > No, when try_cmpxchg() fails it will update oldp. This is the reason old
> > is now a pointer too.
>
> Since you're not the first person confused by this, does the below
> clarify?
>
> ---
> Subject: Documentation/atomic_t: Document cmpxchg() vs try_cmpxchg()
> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Date: Mon Jul 5 17:00:24 CEST 2021
>
> There seems to be a significant amount of confusion around the 'new'
> try_cmpxchg(), despite this being more like the C11
> atomic_compare_exchange_*() family. Add a few words of clarification
> on how cmpxchg() and try_cmpxchg() relate to one another.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> Documentation/atomic_t.txt | 41 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 41 insertions(+)

With the "CMPXHG" typo fixed:

Acked-by: Will Deacon <will@xxxxxxxxxx>

Will