maple_tree: mas_spanning_rebalance() patches
Subsystems (3)
cover maple_tree: mas_spanning_rebalance() patches
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(-)
Signature · 1 line
2.35.1
PATCH 1/2 maple_tree: Fix mas_spanning_rebalance() corner case
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.
--- lib/maple_tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/maple_tree.c +3 -2
@@ -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);
Signature · 1 line
2.35.1
PATCH 2/2 test_maple_tree: Add test for spanning store to most of the tree
In reply to Liam HowlettTest spanning almost the entire tree to detect if the root is dead and the node is placed in the wrong location.
--- lib/test_maple_tree.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
lib/test_maple_tree.c +9 -1
@@ -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)
Signature · 1 line
2.35.1