Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Link: https://lkml.kernel.org/r/20260130205935.2559335-21-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Andrew Ballance <andrewjballance@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Christian Kujau <lists@nerdbynature.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: SeongJae Park <sj@kernel.org>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Liam R. Howlett and committed by
Andrew Morton
62e9d349 448ec8c0

+23 -24
+23 -24
lib/maple_tree.c
··· 3720 3720 } 3721 3721 3722 3722 /* 3723 - * mas_commit_b_node() - Commit the big node into the tree. 3724 - * @wr_mas: The maple write state 3725 - * @b_node: The maple big node 3726 - */ 3727 - static noinline_for_kasan void mas_commit_b_node(struct ma_wr_state *wr_mas, 3728 - struct maple_big_node *b_node) 3729 - { 3730 - enum store_type type = wr_mas->mas->store_type; 3731 - 3732 - WARN_ON_ONCE(type != wr_rebalance && type != wr_split_store); 3733 - 3734 - if (type == wr_rebalance) 3735 - return mas_rebalance(wr_mas->mas, b_node); 3736 - 3737 - return mas_split(wr_mas->mas, b_node); 3738 - } 3739 - 3740 - /* 3741 3723 * mas_root_expand() - Expand a root to a node 3742 3724 * @mas: The maple state 3743 3725 * @entry: The entry to store into the tree ··· 4355 4373 } 4356 4374 4357 4375 /* 4358 - * mas_wr_bnode() - Slow path for a modification. 4376 + * mas_wr_split() - Expand one node into two 4359 4377 * @wr_mas: The write maple state 4360 - * 4361 - * This is where split, rebalance end up. 4362 4378 */ 4363 - static void mas_wr_bnode(struct ma_wr_state *wr_mas) 4379 + static noinline_for_kasan void mas_wr_split(struct ma_wr_state *wr_mas) 4364 4380 { 4365 4381 struct maple_big_node b_node; 4366 4382 4367 4383 trace_ma_write(TP_FCT, wr_mas->mas, 0, wr_mas->entry); 4368 4384 memset(&b_node, 0, sizeof(struct maple_big_node)); 4369 4385 mas_store_b_node(wr_mas, &b_node, wr_mas->offset_end); 4370 - mas_commit_b_node(wr_mas, &b_node); 4386 + WARN_ON_ONCE(wr_mas->mas->store_type != wr_split_store); 4387 + return mas_split(wr_mas->mas, &b_node); 4388 + } 4389 + 4390 + /* 4391 + * mas_wr_rebalance() - Insufficient data in one node needs to either get data 4392 + * from a sibling or absorb a sibling all together. 4393 + * @wr_mas: The write maple state 4394 + */ 4395 + static noinline_for_kasan void mas_wr_rebalance(struct ma_wr_state *wr_mas) 4396 + { 4397 + struct maple_big_node b_node; 4398 + 4399 + trace_ma_write(__func__, wr_mas->mas, 0, wr_mas->entry); 4400 + memset(&b_node, 0, sizeof(struct maple_big_node)); 4401 + mas_store_b_node(wr_mas, &b_node, wr_mas->offset_end); 4402 + WARN_ON_ONCE(wr_mas->mas->store_type != wr_rebalance); 4403 + return mas_rebalance(wr_mas->mas, &b_node); 4371 4404 } 4372 4405 4373 4406 /* ··· 4413 4416 mas_wr_spanning_store(wr_mas); 4414 4417 break; 4415 4418 case wr_split_store: 4419 + mas_wr_split(wr_mas); 4420 + break; 4416 4421 case wr_rebalance: 4417 - mas_wr_bnode(wr_mas); 4422 + mas_wr_rebalance(wr_mas); 4418 4423 break; 4419 4424 case wr_new_root: 4420 4425 mas_new_root(mas, wr_mas->entry);