[PATCH v2 2/4] test_maple_tree: test a full maple_range_64 node in RCU mode
From: Dimitris Charisis
Date: Wed Sep 16 2026 - 08:01:36 EST
Add a test that builds a tree whose root is a full maple_range_64 node.
Ensure the destruction under RCU does not misinterpret the last slot
as metadata. 226 insertions produce such a root on a 64-bit build.
Signed-off-by: Dimitris Charisis <dchar@xxxxxxxxxxxxxxxxx>
---
lib/test_maple_tree.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c
index b9367c61e8b50d107ab972fc5222fb6a531fad87..461bb0e4816ef6e9c670018a13a88a0e5d0cf89e 100644
--- a/lib/test_maple_tree.c
+++ b/lib/test_maple_tree.c
@@ -3710,6 +3710,23 @@ static noinline void __init alloc_cyclic_testing(struct maple_tree *mt)
MT_BUG_ON(mt, ret != 1);
}
+static noinline void __init check_range64_in_rcu(struct maple_tree *mt)
+{
+ unsigned long i;
+ unsigned long nr_entries = 226; /* Build a full maple_range_64 root node */
+
+ MT_BUG_ON(mt, !mtree_empty(mt));
+ mt_init_flags(mt, MT_FLAGS_USE_RCU);
+
+ for (i = 0; i < nr_entries; i++) {
+ MT_BUG_ON(mt, mtree_test_insert_range(mt, i*10, i*10 + 9,
+ xa_mk_value(i)));
+ }
+
+ mtree_destroy(mt);
+ rcu_barrier();
+}
+
static DEFINE_MTREE(tree);
static int __init maple_tree_seed(void)
{
@@ -3999,6 +4016,8 @@ static int __init maple_tree_seed(void)
alloc_cyclic_testing(&tree);
mtree_destroy(&tree);
+ check_range64_in_rcu(&tree);
+
#if defined(BENCH)
skip:
--
2.47.3