]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Remove smp_wmb() from mas_wmb_replace() maple_for6.2
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 13 Dec 2022 14:06:29 +0000 (09:06 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 13 Dec 2022 21:22:37 +0000 (16:22 -0500)
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 <Liam.Howlett@oracle.com>
lib/maple_tree.c

index 824e2ed2a029beccda02785d227b3460795fdf7d..4b31fb34905fe433bfb11671ff0a1ec6dea9f42d 100644 (file)
@@ -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;
 }