[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <q5chl5fnmaj6wxlj3aclz7n3k4bz5sgjfliao37wdiefi32mgi@wxefcss6cmqp>
Date: Mon, 1 Sep 2025 11:29:05 +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 4/4] tools: testing: Use existing atomic.h for
vma/maple tests
On Thu, Aug 28, 2025 at 12:28:01PM +0000, Brendan Jackman wrote:
> The shared userspace logic used for unit-testing maple tree and VMA code
> currently has its own replacements for atomics helpers. This is not
> needed as the necessary APIs already have userspace implementations in
> the tools tree. Switching over to that allows deleting a bit of code.
>
> Note that the implementation is different; while the version being
> deleted here is implemented using liburcu, the existing version in tools
> uses either x86 asm or compiler builtins. It's assumed that both are
> equally likely to be correct.
>
> The tools tree's version of atomic_t is a struct type while the version
> being deleted was just a typedef of an integer. This means it's no
> longer valid to call __sync_bool_compare_and_swap() directly on it. One
> option would be to just peek into the struct and call it on the field,
> but it seems a little cleaner to just use the corresponding atomic.h
> API whic has been added recently. Now the fake mapping_map_writable() is
> copied from the real one.
>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> Signed-off-by: Brendan Jackman <jackmanb@...gle.com>
Reviewed-by: Pedro Falcato <pfalcato@...e.de>
> ---
> tools/testing/shared/linux/maple_tree.h | 6 ++----
> tools/testing/vma/linux/atomic.h | 17 -----------------
> tools/testing/vma/vma_internal.h | 12 +++---------
> 3 files changed, 5 insertions(+), 30 deletions(-)
Yay, less code! :)
--
Pedro
Powered by blists - more mailing lists