[PATCH v2 4/4] test_maple_tree: test a maple_range_64 metadata slot in RCU mode
From: Dimitris Charisis
Date: Wed Sep 16 2026 - 08:07:45 EST
Add a test that builds a height 3 tree whose root holds 15 child
pointers and metadata in its last slot, so every slot is non-zero.
Ensure the destruction under RCU does not descend into the metadata
slot. 3166 insertions produce such a tree on a 64-bit build.
Signed-off-by: Dimitris Charisis <dchar@xxxxxxxxxxxxxxxxx>
---
lib/test_maple_tree.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c
index 461bb0e4816ef6e9c670018a13a88a0e5d0cf89e..fb40e193a3cb76f0eb02af3aa4a38630692a4a9b 100644
--- a/lib/test_maple_tree.c
+++ b/lib/test_maple_tree.c
@@ -3725,6 +3725,19 @@ static noinline void __init check_range64_in_rcu(struct maple_tree *mt)
mtree_destroy(mt);
rcu_barrier();
+
+ nr_entries = 3166; /* Height 3. Root has 15 children + metadata */
+
+ 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);
--
2.47.3