Re: [PATCH] locking/atomic: scripts: clarify ordering of conditional atomics

From: Mark Rutland
Date: Fri Feb 09 2024 - 07:35:50 EST


On Tue, Feb 06, 2024 at 10:40:05AM -0800, Nhat Pham wrote:
> Let me bring in some beginners' perspective :)
>
> For the most part, LGTM! My only comment is regarding the conditional
> atomics with relaxed ordering on success:
>
> /**
> * If (@v == @old), atomically updates @v to @new with relaxed ordering.
> + * Otherwise, @v is not modified and no ordering is provided.
>
> This is technically correct, but it can be confusing. It reads as if
> "relaxed ordering" is much different from no ordering, since we are
> juxtaposing them when we compare what happens when the condition holds
> v.s when it does not.
>
> This can be potentially confusing to unfamiliar users. I consulted
> with Paul about this, and he suggested this rewording, which I like
> better:
>
> "Otherwise, @v is not modified and relaxed ordering is provided."

I agree that makes sense, and doing the same in the commit message makes that
simpler and clearer too!

> With something along that line in place:
> Reviewed-by: Nhat Pham <nphamcs@xxxxxxxxx>

Thanks; I'll fold the above in for v2.

Mark.