[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tnbyxwmcwia3teewhqlpdjk7igsljfqcqbze2rbalzidccfndy@e3ybvfap4pbd>
Date: Mon, 1 Sep 2025 11:27:47 +0100
From: Pedro Falcato <pfalcato@...e.de>
To: Brendan Jackman <jackmanb@...gle.com>
Cc: "Liam R. Howlett" <Liam.Howlett@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, Jann Horn <jannh@...gle.com>, linux-kernel@...r.kernel.org,
maple-tree@...ts.infradead.org, linux-mm@...ck.org
Subject: Re: [PATCH v2 1/4] tools/include: Implement a couple of atomic_t ops
On Thu, Aug 28, 2025 at 12:27:58PM +0000, Brendan Jackman wrote:
> The VMA tests need an operation equivalent to
> atomic_inc_unless_negative() to implement a fake mapping_map_writable().
> Adding it will enable them to switch to the shared atomic headers and
> simplify that fake implementation.
>
> In order to add that, also add atomic_try_cmpxchg() which can be used to
> implement it. This is copied from Documentation/atomic_t.txt. Then,
> implement atomic_inc_unless_negative() itself based on the
> raw_atomic_dec_unless_positive() in
> include/linux/atomic/atomic-arch-fallback.h.
>
> There's no present need for a highly-optimised version of this (nor any
> reason to think this implementation is sub-optimal on x86) so just
> implement this with generic C, no x86-specifics.
>
> Signed-off-by: Brendan Jackman <jackmanb@...gle.com>
Reviewed-by: Pedro Falcato <pfalcato@...e.de>
LGTM, thanks!
--
Pedro
Powered by blists - more mailing lists