[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c1ccb6b2-a981-478f-ab7e-91078a6d31ba@lucifer.local>
Date: Fri, 20 Jun 2025 16:51:30 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: "Liam R. Howlett" <Liam.Howlett@...cle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, maple-tree@...ts.infradead.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org, stable@...nel.org,
Suren Baghdasaryan <surenb@...gle.com>,
Hailong Liu <hailong.liu@...o.com>, zhangpeng.00@...edance.com,
Steve Kang <Steve.Kang@...soc.com>,
Matthew Wilcox <willy@...radead.org>,
Sidhartha Kumar <sidhartha.kumar@...cle.com>
Subject: Re: [PATCH 3/3] tools/testing/radix-tree: Test maple tree chaining
mas_preallocate() calls
On Mon, Jun 16, 2025 at 02:45:21PM -0400, Liam R. Howlett wrote:
> Testing calling multiple mas_preallocate() calls in a row after
> adjusting the maple state. Ensures new calls to mas_preallocate() will
> change the number of allocated nodes.
Really helpful to have a regression test for such a fiddly thing!
>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
Acked-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> ---
> tools/testing/radix-tree/maple.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c
> index 6a5b0342941c4..49e89dfad950c 100644
> --- a/tools/testing/radix-tree/maple.c
> +++ b/tools/testing/radix-tree/maple.c
> @@ -35693,6 +35693,18 @@ static noinline void __init check_prealloc(struct maple_tree *mt)
> allocated = mas_allocated(&mas);
> height = mas_mt_height(&mas);
> MT_BUG_ON(mt, allocated != 0);
> +
> + /* Chaining multiple preallocations */
> + mt_set_in_rcu(mt);
> + mas_set_range(&mas, 800, 805); /* Slot store, should be 0 allocations */
> + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
> + allocated = mas_allocated(&mas);
> + MT_BUG_ON(mt, allocated != 0);
> + mas.last = 809; /* Node store */
> + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
> + allocated = mas_allocated(&mas);
> + MT_BUG_ON(mt, allocated != 1);
> + mas_store_prealloc(&mas, ptr);
> }
> /* End of preallocation testing */
>
> --
> 2.47.2
>
Powered by blists - more mailing lists