[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260115193647.1695937-20-Liam.Howlett@oracle.com>
Date: Thu, 15 Jan 2026 14:36:38 -0500
From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: maple-tree@...ts.infradead.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Suren Baghdasaryan <surenb@...gle.com>,
Matthew Wilcox <willy@...radead.org>,
Sidhartha Kumar <sidhartha.kumar@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, Alice Ryhl <aliceryhl@...gle.com>,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Arnd Bergmann <arnd@...db.de>, Christian Kujau <lists@...dbynature.de>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>
Subject: [PATCH 19/28] maple_tree: Separate wr_split_store and wr_rebalance store type code path
The split and rebalance store types both go through the same function
that uses the big node. Separate the code paths so that each can be
updated independently.
No functional change intended
Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
---
lib/maple_tree.c | 47 +++++++++++++++++++++++------------------------
1 file changed, 23 insertions(+), 24 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 70225f7856258..5d871d91ca49b 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -3689,24 +3689,6 @@ static void mas_split(struct ma_state *mas, struct maple_big_node *b_node)
mtree_range_walk(mas);
}
-/*
- * mas_commit_b_node() - Commit the big node into the tree.
- * @wr_mas: The maple write state
- * @b_node: The maple big node
- */
-static noinline_for_kasan void mas_commit_b_node(struct ma_wr_state *wr_mas,
- struct maple_big_node *b_node)
-{
- enum store_type type = wr_mas->mas->store_type;
-
- WARN_ON_ONCE(type != wr_rebalance && type != wr_split_store);
-
- if (type == wr_rebalance)
- return mas_rebalance(wr_mas->mas, b_node);
-
- return mas_split(wr_mas->mas, b_node);
-}
-
/*
* mas_root_expand() - Expand a root to a node
* @mas: The maple state
@@ -4343,19 +4325,34 @@ static inline void mas_wr_append(struct ma_wr_state *wr_mas,
}
/*
- * mas_wr_bnode() - Slow path for a modification.
+ * mas_wr_split() - Expand one node into two
* @wr_mas: The write maple state
- *
- * This is where split, rebalance end up.
*/
-static void mas_wr_bnode(struct ma_wr_state *wr_mas)
+static noinline_for_kasan void mas_wr_split(struct ma_wr_state *wr_mas)
{
struct maple_big_node b_node;
trace_ma_write(TP_FCT, wr_mas->mas, 0, wr_mas->entry);
memset(&b_node, 0, sizeof(struct maple_big_node));
mas_store_b_node(wr_mas, &b_node, wr_mas->offset_end);
- mas_commit_b_node(wr_mas, &b_node);
+ WARN_ON_ONCE(wr_mas->mas->store_type != wr_split_store);
+ return mas_split(wr_mas->mas, &b_node);
+}
+
+/*
+ * mas_wr_rebalance() - Insufficient data in one node needs to either get data
+ * from a sibling or absorb a sibling all together.
+ * @wr_mas: The write maple state
+ */
+static noinline_for_kasan void mas_wr_rebalance(struct ma_wr_state *wr_mas)
+{
+ struct maple_big_node b_node;
+
+ trace_ma_write(__func__, wr_mas->mas, 0, wr_mas->entry);
+ memset(&b_node, 0, sizeof(struct maple_big_node));
+ mas_store_b_node(wr_mas, &b_node, wr_mas->offset_end);
+ WARN_ON_ONCE(wr_mas->mas->store_type != wr_rebalance);
+ return mas_rebalance(wr_mas->mas, &b_node);
}
/*
@@ -4386,8 +4383,10 @@ static inline void mas_wr_store_entry(struct ma_wr_state *wr_mas)
mas_wr_spanning_store(wr_mas);
break;
case wr_split_store:
+ mas_wr_split(wr_mas);
+ break;
case wr_rebalance:
- mas_wr_bnode(wr_mas);
+ mas_wr_rebalance(wr_mas);
break;
case wr_new_root:
mas_new_root(mas, wr_mas->entry);
--
2.47.3
Powered by blists - more mailing lists