From: Liam R. Howlett Date: Tue, 13 Dec 2022 14:06:29 +0000 (-0500) Subject: maple_tree: Remove smp_wmb() from mas_wmb_replace() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fmaple_for6.2;p=users%2Fjedix%2Flinux-maple.git maple_tree: Remove smp_wmb() from mas_wmb_replace() Since nodes now reused the pivots for tracking other dead nodes, the smp_wmb() needed to be called sooner. Remove the later call and rename the mas_wmb_replace() function to mas_cleanup_replace() since it no longer calls any write memory barriers. This is an optimization fix for the maple tree. Fixes: 54a611b60590 ("Maple Tree: add new data structure") Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 824e2ed2a029..4b31fb34905f 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2795,20 +2795,16 @@ static inline void mast_set_split_parents(struct maple_subtree_state *mast, } /* - * mas_wmb_replace() - Write memory barrier and replace + * mas_cleanup_replace() - Free any necessary nodes and insert the new sub-tree * @mas: The maple state * @free: the maple topiary list of nodes to free * @destroy: The maple topiary list of nodes to destroy (walk and free) * * Updates gap as necessary. */ -static inline void mas_wmb_replace(struct ma_state *mas, - struct ma_topiary *free, - struct ma_topiary *destroy) +static inline void mas_cleanup_replace(struct ma_state *mas, + struct ma_topiary *free, struct ma_topiary *destroy) { - /* All nodes must see old data as dead prior to replacing that data */ - smp_wmb(); /* Needed for RCU */ - /* Insert the new data in the tree */ mas_replace(mas, true); @@ -3145,7 +3141,7 @@ new_root: mast->orig_l->depth = mas->depth; mast->orig_l->alloc = mas->alloc; *mas = *mast->orig_l; - mas_wmb_replace(mas, &free, &destroy); + mas_cleanup_replace(mas, &free, &destroy); mtree_range_walk(mas); return mast->bn->b_end; } @@ -3600,7 +3596,7 @@ static int mas_split(struct ma_state *mas, struct maple_big_node *b_node) /* Set the original node as dead */ mat_add(mast.free, mas->node); mas->node = l_mas.node; - mas_wmb_replace(mas, mast.free, NULL); + mas_cleanup_replace(mas, mast.free, NULL); mtree_range_walk(mas); return 1; }