]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: testing fix for spanning store on 32b
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 28 Aug 2025 00:30:23 +0000 (20:30 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:25:26 +0000 (17:25 -0700)
32 bit nodes have a larger branching factor.  This affects the required
value to cause a height change.  Update the spanning store height test to
work for both 64 and 32 bit nodes.

Link: https://lkml.kernel.org/r/20250828003023.418966-3-Liam.Howlett@oracle.com
Fixes: f9d3a963fef4 ("maple_tree: use height and depth consistently")
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/radix-tree/maple.c

index 90a0db45a33c388cfcbf665483ad87ff381c0ae7..05714c22994ea36b7c7bcecfcf45aeed875f6b5b 100644 (file)
@@ -36327,13 +36327,18 @@ extern void test_kmem_cache_bulk(void);
 static inline void check_spanning_store_height(struct maple_tree *mt)
 {
        int index = 0;
+       int last = 140;
        MA_STATE(mas, mt, 0, 0);
        mas_lock(&mas);
        while (mt_height(mt) != 3) {
                mas_store_gfp(&mas, xa_mk_value(index), GFP_KERNEL);
                mas_set(&mas, ++index);
        }
-       mas_set_range(&mas, 90, 140);
+
+       if (MAPLE_32BIT)
+               last = 155; /* 32 bit higher branching factor. */
+
+       mas_set_range(&mas, 90, last);
        mas_store_gfp(&mas, xa_mk_value(index), GFP_KERNEL);
        MT_BUG_ON(mt, mas_mt_height(&mas) != 2);
        mas_unlock(&mas);