linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, stable@kernel.org,
	Suren Baghdasaryan <surenb@google.com>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.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>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>
Subject: [PATCH 3/3] tools/testing/radix-tree: Test maple tree chaining mas_preallocate() calls
Date: Mon, 16 Jun 2025 14:45:21 -0400	[thread overview]
Message-ID: <20250616184521.3382795-4-Liam.Howlett@oracle.com> (raw)
In-Reply-To: <20250616184521.3382795-1-Liam.Howlett@oracle.com>

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.

Signed-off-by: Liam R. Howlett <Liam.Howlett@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



  parent reply	other threads:[~2025-06-16 18:46 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 ` Liam R. Howlett [this message]
2025-06-20 15:51   ` [PATCH 3/3] tools/testing/radix-tree: Test maple tree chaining mas_preallocate() calls Lorenzo Stoakes
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=20250616184521.3382795-4-Liam.Howlett@oracle.com \
    --to=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=lorenzo.stoakes@oracle.com \
    --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