Skip to contentSkip to conversation

maple_tree-break-on-convergence-in-mas_spanning_rebalance.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message May 12, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: maple_tree: break on convergence in mas_spanning_rebalance()
has been removed from the -mm tree. Its filename was
maple_tree-break-on-convergence-in-mas_spanning_rebalance.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Sidhartha Kumar <[email protected]>
Subject: maple_tree: break on convergence in mas_spanning_rebalance()
Date: Thu, 10 Apr 2025 19:14:44 +0000

This allows support for using the vacant height to calculate the worst case number of nodes needed for wr_rebalance operation. mas_spanning_rebalance() was seen to perform unnecessary node allocations. We can reduce allocations by breaking early during the rebalancing loop once we realize that we have ascended to a common ancestor.

---

 lib/maple_tree.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
lib/maple_tree.c renamed from lib/maple_tree.c~maple_tree-break-on-convergence-in-mas_spanning_rebalance +13 -3
@@ -2893,11 +2893,21 @@ static void mas_spanning_rebalance(struc
 		mast_combine_cp_right(mast);
 		mast->orig_l->last = mast->orig_l->max;
 
-		if (mast_sufficient(mast))
-			continue;
+		if (mast_sufficient(mast)) {
+			if (mast_overflow(mast))
+				continue;
+
+			if (mast->orig_l->node == mast->orig_r->node) {
+			       /*
+				* The data in b_node should be stored in one
+				* node and in the tree
+				*/
+				slot = mast->l->offset;
+				break;
+			}
 
-		if (mast_overflow(mast))
 			continue;
+		}
 
 		/* May be a new root stored in mast->bn */
 		if (mas_is_root_limits(mast->orig_l))

_

Patches currently in -mm which might be from [email protected] are