linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	maple-tree@lists.infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, stable@kernel.org,
	Suren Baghdasaryan <surenb@google.com>,
	Hailong Liu <hailong.liu@oppo.com>,
	zhangpeng.00@bytedance.com, Steve Kang <Steve.Kang@unisoc.com>,
	Matthew Wilcox <willy@infradead.org>,
	Sidhartha Kumar <sidhartha.kumar@oracle.com>
Subject: Re: [PATCH 3/3] tools/testing/radix-tree: Test maple tree chaining mas_preallocate() calls
Date: Fri, 20 Jun 2025 16:51:30 +0100	[thread overview]
Message-ID: <c1ccb6b2-a981-478f-ab7e-91078a6d31ba@lucifer.local> (raw)
In-Reply-To: <20250616184521.3382795-4-Liam.Howlett@oracle.com>

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@oracle.com>

Acked-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.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
>


  reply	other threads:[~2025-06-20 15:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-16 18:45 [PATCH 0/3] Fix MA_STATE_PREALLOC issue Liam R. Howlett
2025-06-16 18:45 ` [PATCH 1/3] testing/raix-tree/maple: Increase readers and reduce delay for faster machines Liam R. Howlett
2025-06-20 15:43   ` Lorenzo Stoakes
2025-06-16 18:45 ` [PATCH 2/3] maple_tree: Fix MA_STATE_PREALLOC flag in mas_preallocate() Liam R. Howlett
2025-06-20 15:50   ` Lorenzo Stoakes
2025-06-16 18:45 ` [PATCH 3/3] tools/testing/radix-tree: Test maple tree chaining mas_preallocate() calls Liam R. Howlett
2025-06-20 15:51   ` Lorenzo Stoakes [this message]
2025-06-16 23:24 ` [PATCH 0/3] Fix MA_STATE_PREALLOC issue Andrew Morton
2025-06-20 18:20   ` Liam R. Howlett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c1ccb6b2-a981-478f-ab7e-91078a6d31ba@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=Steve.Kang@unisoc.com \
    --cc=akpm@linux-foundation.org \
    --cc=hailong.liu@oppo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=sidhartha.kumar@oracle.com \
    --cc=stable@kernel.org \
    --cc=surenb@google.com \
    --cc=willy@infradead.org \
    --cc=zhangpeng.00@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox