]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Update mas_preallocate() testing
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 2 May 2023 15:07:14 +0000 (11:07 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 2 May 2023 17:56:44 +0000 (13:56 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
tools/testing/radix-tree/maple.c

index 1049f934caa859ee97950c19877d4fbf371d0ba9..fe4b3744b87f42c41542660bf24a20ef8ccba819 100644 (file)
@@ -35358,6 +35358,8 @@ static noinline void check_prealloc(struct maple_tree *mt)
        for (i = 0; i <= max; i++)
                mtree_test_store_range(mt, i * 10, i * 10 + 5, &i);
 
+       /* Spanning store */
+       mas_set_range(&mas, 470, 500);
        MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
        allocated = mas_allocated(&mas);
        height = mas_mt_height(&mas);
@@ -35381,7 +35383,6 @@ static noinline void check_prealloc(struct maple_tree *mt)
        MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
        allocated = mas_allocated(&mas);
        height = mas_mt_height(&mas);
-       MT_BUG_ON(mt, allocated == 0);
        MT_BUG_ON(mt, allocated != 1 + height * 3);
        mn = mas_pop_node(&mas);
        MT_BUG_ON(mt, mas_allocated(&mas) != allocated - 1);
@@ -35395,7 +35396,6 @@ static noinline void check_prealloc(struct maple_tree *mt)
        MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
        allocated = mas_allocated(&mas);
        height = mas_mt_height(&mas);
-       MT_BUG_ON(mt, allocated == 0);
        MT_BUG_ON(mt, allocated != 1 + height * 3);
        mn = mas_pop_node(&mas);
        MT_BUG_ON(mt, mas_allocated(&mas) != allocated - 1);
@@ -35409,7 +35409,6 @@ static noinline void check_prealloc(struct maple_tree *mt)
        MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
        allocated = mas_allocated(&mas);
        height = mas_mt_height(&mas);
-       MT_BUG_ON(mt, allocated == 0);
        MT_BUG_ON(mt, allocated != 1 + height * 3);
        mn = mas_pop_node(&mas);
        MT_BUG_ON(mt, mas_allocated(&mas) != allocated - 1);
@@ -35423,33 +35422,37 @@ static noinline void check_prealloc(struct maple_tree *mt)
        MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
        allocated = mas_allocated(&mas);
        height = mas_mt_height(&mas);
-       MT_BUG_ON(mt, allocated == 0);
        MT_BUG_ON(mt, allocated != 1 + height * 3);
        mas_store_prealloc(&mas, ptr);
        MT_BUG_ON(mt, mas_allocated(&mas) != 0);
 
+       /* Slot store does not need allocations */
+       mas_set_range(&mas, 6, 9);
        MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
        allocated = mas_allocated(&mas);
-       height = mas_mt_height(&mas);
-       MT_BUG_ON(mt, allocated == 0);
-       MT_BUG_ON(mt, allocated != 1 + height * 3);
+       MT_BUG_ON(mt, allocated != 0);
        mas_store_prealloc(&mas, ptr);
        MT_BUG_ON(mt, mas_allocated(&mas) != 0);
+
+       mas_set_range(&mas, 6, 10);
        MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
        allocated = mas_allocated(&mas);
        height = mas_mt_height(&mas);
-       MT_BUG_ON(mt, allocated == 0);
-       MT_BUG_ON(mt, allocated != 1 + height * 3);
+       MT_BUG_ON(mt, allocated != 1);
        mas_store_prealloc(&mas, ptr);
+       MT_BUG_ON(mt, mas_allocated(&mas) != 0);
 
+       /* Split */
+       mas_set_range(&mas, 54, 54);
        MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
        allocated = mas_allocated(&mas);
        height = mas_mt_height(&mas);
-       MT_BUG_ON(mt, allocated == 0);
-       MT_BUG_ON(mt, allocated != 1 + height * 3);
+       MT_BUG_ON(mt, allocated != 1 + height * 2);
        mas_store_prealloc(&mas, ptr);
        MT_BUG_ON(mt, mas_allocated(&mas) != 0);
        mt_set_non_kernel(1);
+       /* Spanning store */
+       mas_set_range(&mas, 1, 100);
        MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL & GFP_NOWAIT) == 0);
        allocated = mas_allocated(&mas);
        height = mas_mt_height(&mas);
@@ -35457,6 +35460,7 @@ static noinline void check_prealloc(struct maple_tree *mt)
        mas_destroy(&mas);
 
 
+       /* Spanning store */
        MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0);
        allocated = mas_allocated(&mas);
        height = mas_mt_height(&mas);
@@ -35464,6 +35468,7 @@ static noinline void check_prealloc(struct maple_tree *mt)
        MT_BUG_ON(mt, allocated != 1 + height * 3);
        mas_store_prealloc(&mas, ptr);
        MT_BUG_ON(mt, mas_allocated(&mas) != 0);
+       mas_set_range(&mas, 0, 200);
        mt_set_non_kernel(1);
        MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL & GFP_NOWAIT) == 0);
        allocated = mas_allocated(&mas);