* [PATCH Fix 0/2] maple_tree: mas_spanning_rebalance() patches
@ 2022-06-29 15:23 Liam Howlett
2022-06-29 15:23 ` [PATCH Fix 1/2] maple_tree: Fix mas_spanning_rebalance() corner case Liam Howlett
2022-06-29 15:23 ` [PATCH Fix 2/2] test_maple_tree: Add test for spanning store to most of the tree Liam Howlett
0 siblings, 2 replies; 3+ messages in thread
From: Liam Howlett @ 2022-06-29 15:23 UTC (permalink / raw)
To: maple-tree, linux-mm, linux-kernel, Andrew Morton; +Cc: Yu Zhao
Andrew,
Please apply these to the maple tree series after the indicated 'fixes'
patches. This fixes a soft lockup reported by Yu and adds a testcase to
the test_maple_tree suite.
Thanks,
Liam
Liam R. Howlett (2):
maple_tree: Fix mas_spanning_rebalance() corner case
test_maple_tree: Add test for spanning store to most of the tree
lib/maple_tree.c | 5 +++--
lib/test_maple_tree.c | 10 +++++++++-
2 files changed, 12 insertions(+), 3 deletions(-)
--
2.35.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH Fix 1/2] maple_tree: Fix mas_spanning_rebalance() corner case
2022-06-29 15:23 [PATCH Fix 0/2] maple_tree: mas_spanning_rebalance() patches Liam Howlett
@ 2022-06-29 15:23 ` Liam Howlett
2022-06-29 15:23 ` [PATCH Fix 2/2] test_maple_tree: Add test for spanning store to most of the tree Liam Howlett
1 sibling, 0 replies; 3+ messages in thread
From: Liam Howlett @ 2022-06-29 15:23 UTC (permalink / raw)
To: maple-tree, linux-mm, linux-kernel, Andrew Morton; +Cc: Yu Zhao
When a node is insufficient during a spanning rebalance loop and
mast_spanning_rebalance() is called to combine neighbouring nodes, the
loop should not terminate regardless of if neighbours exist or not.
This will allow the data to be stored in the correct node.
Reported-by: Yu Zhao <yuzhao@google.com>
Fixes: 37a4d714b7d9 (maple_tree: fix underflow in mas_spanning_rebalance())
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
lib/maple_tree.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index d8457122ca5d..2cccd8f2153f 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -3029,8 +3029,7 @@ static int mas_spanning_rebalance(struct ma_state *mas,
if (mas_is_root_limits(mast->orig_l))
break;
- if (!mast_spanning_rebalance(mast))
- break;
+ mast_spanning_rebalance(mast);
/* rebalancing from other nodes may require another loop. */
if (!count)
@@ -6521,6 +6520,7 @@ static inline void *mas_first_entry(struct ma_state *mas, struct maple_node *mn,
max = mas->max;
mas->offset = 0;
while (likely(!ma_is_leaf(mt))) {
+ MT_BUG_ON(mas->tree, mte_dead_node(mas->node));
slots = ma_slots(mn, mt);
pivots = ma_pivots(mn, mt);
max = pivots[0];
@@ -6531,6 +6531,7 @@ static inline void *mas_first_entry(struct ma_state *mas, struct maple_node *mn,
mn = mas_mn(mas);
mt = mte_node_type(mas->node);
}
+ MT_BUG_ON(mas->tree, mte_dead_node(mas->node));
mas->max = max;
slots = ma_slots(mn, mt);
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH Fix 2/2] test_maple_tree: Add test for spanning store to most of the tree
2022-06-29 15:23 [PATCH Fix 0/2] maple_tree: mas_spanning_rebalance() patches Liam Howlett
2022-06-29 15:23 ` [PATCH Fix 1/2] maple_tree: Fix mas_spanning_rebalance() corner case Liam Howlett
@ 2022-06-29 15:23 ` Liam Howlett
1 sibling, 0 replies; 3+ messages in thread
From: Liam Howlett @ 2022-06-29 15:23 UTC (permalink / raw)
To: maple-tree, linux-mm, linux-kernel, Andrew Morton; +Cc: Yu Zhao
Test spanning almost the entire tree to detect if the root is dead and
the node is placed in the wrong location.
Fixes: 1d3ae73e4e86 (test_maple_tree: Add test for spanning store to most of the tree)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
lib/test_maple_tree.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c
index 8de5705b7b9b..b028f5648857 100644
--- a/lib/test_maple_tree.c
+++ b/lib/test_maple_tree.c
@@ -35685,7 +35685,6 @@ static noinline void check_spanning_write(struct maple_tree *mt)
mas_set(&mas, 1205);
MT_BUG_ON(mt, mas_walk(&mas) != NULL);
mtree_unlock(mt);
- mt_dump(mt);
mt_validate(mt);
mtree_destroy(mt);
@@ -35817,6 +35816,15 @@ static noinline void check_spanning_write(struct maple_tree *mt)
MT_BUG_ON(mt, mas_walk(&mas) != NULL);
mtree_unlock(mt);
mtree_destroy(mt);
+
+ mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE);
+ for (i = 0; i <= 100; i++)
+ mtree_test_store_range(mt, i * 10, i * 10 + 5, &i);
+
+ mtree_lock(mt);
+ mas_set_range(&mas, 76, 875);
+ mas_store_gfp(&mas, NULL, GFP_KERNEL);
+ mtree_unlock(mt);
}
static noinline void check_null_expand(struct maple_tree *mt)
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-29 15:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 15:23 [PATCH Fix 0/2] maple_tree: mas_spanning_rebalance() patches Liam Howlett
2022-06-29 15:23 ` [PATCH Fix 1/2] maple_tree: Fix mas_spanning_rebalance() corner case Liam Howlett
2022-06-29 15:23 ` [PATCH Fix 2/2] test_maple_tree: Add test for spanning store to most of the tree Liam Howlett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).