Commit 7a93c71a authored by Liam R. Howlett's avatar Liam R. Howlett Committed by Andrew Morton

maple_tree: fix 32 bit mas_next testing

The test setup of mas_next is dependent on node entry size to create a 2
level tree, but the tests did not account for this in the expected value
when shifting beyond the scope of the tree.

Fix this by setting up the test to succeed depending on the node entries
which is dependent on the 32/64 bit setup.

Link: https://lkml.kernel.org/r/20230712173916.168805-1-Liam.Howlett@oracle.com
Fixes: 120b1162 ("maple_tree: reorganize testing to restore module testing")
Signed-off-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>
Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
  Closes: https://lore.kernel.org/linux-mm/CAMuHMdV4T53fOw7VPoBgPR7fP6RYqf=CBhD_y_vOg53zZX_DnA@mail.gmail.com/Tested-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 25b5949c
...@@ -1898,13 +1898,16 @@ static noinline void __init next_prev_test(struct maple_tree *mt) ...@@ -1898,13 +1898,16 @@ static noinline void __init next_prev_test(struct maple_tree *mt)
725}; 725};
static const unsigned long level2_32[] = { 1747, 2000, 1750, 1755, static const unsigned long level2_32[] = { 1747, 2000, 1750, 1755,
1760, 1765}; 1760, 1765};
unsigned long last_index;
if (MAPLE_32BIT) { if (MAPLE_32BIT) {
nr_entries = 500; nr_entries = 500;
level2 = level2_32; level2 = level2_32;
last_index = 0x138e;
} else { } else {
nr_entries = 200; nr_entries = 200;
level2 = level2_64; level2 = level2_64;
last_index = 0x7d6;
} }
for (i = 0; i <= nr_entries; i++) for (i = 0; i <= nr_entries; i++)
...@@ -2011,7 +2014,7 @@ static noinline void __init next_prev_test(struct maple_tree *mt) ...@@ -2011,7 +2014,7 @@ static noinline void __init next_prev_test(struct maple_tree *mt)
val = mas_next(&mas, ULONG_MAX); val = mas_next(&mas, ULONG_MAX);
MT_BUG_ON(mt, val != NULL); MT_BUG_ON(mt, val != NULL);
MT_BUG_ON(mt, mas.index != 0x7d6); MT_BUG_ON(mt, mas.index != last_index);
MT_BUG_ON(mt, mas.last != ULONG_MAX); MT_BUG_ON(mt, mas.last != ULONG_MAX);
val = mas_prev(&mas, 0); val = mas_prev(&mas, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment