From: Wei Yang <richard.weiyang@gmail.com>
To: akpm@linux-foundation.org, Liam.Howlett@oracle.com
Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org,
Wei Yang <richard.weiyang@gmail.com>,
"Liam R . Howlett" <Liam.Howlett@Oracle.com>,
Sidhartha Kumar <sidhartha.kumar@oracle.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Subject: [PATCH 1/7] maple_tree: not necessary to check ahead if !content
Date: Wed, 27 Nov 2024 01:27:47 +0000 [thread overview]
Message-ID: <20241127012753.3393-2-richard.weiyang@gmail.com> (raw)
In-Reply-To: <20241127012753.3393-1-richard.weiyang@gmail.com>
Just like mas_wr_extend_null(), only when content is not NULL, we may
have a NULL slot ahead.
So we can wrap it in an else.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
CC: Sidhartha Kumar <sidhartha.kumar@oracle.com>
CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
lib/maple_tree.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 7efb1520f9bd..98692704d773 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -3568,18 +3568,20 @@ static inline void mas_extend_spanning_null(struct ma_wr_state *l_wr_mas,
unsigned char l_slot;
l_slot = l_mas->offset;
- if (!l_wr_mas->content)
+ if (!l_wr_mas->content) {
+ /* If this one is null, the next and prev are not */
l_mas->index = l_wr_mas->r_min;
+ } else {
+ if ((l_mas->index == l_wr_mas->r_min) &&
+ (l_slot &&
+ !mas_slot_locked(l_mas, l_wr_mas->slots, l_slot - 1))) {
+ if (l_slot > 1)
+ l_mas->index = l_wr_mas->pivots[l_slot - 2] + 1;
+ else
+ l_mas->index = l_mas->min;
- if ((l_mas->index == l_wr_mas->r_min) &&
- (l_slot &&
- !mas_slot_locked(l_mas, l_wr_mas->slots, l_slot - 1))) {
- if (l_slot > 1)
- l_mas->index = l_wr_mas->pivots[l_slot - 2] + 1;
- else
- l_mas->index = l_mas->min;
-
- l_mas->offset = l_slot - 1;
+ l_mas->offset = l_slot - 1;
+ }
}
if (!r_wr_mas->content) {
--
2.34.1
next prev parent reply other threads:[~2024-11-27 1:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 1:27 [PATCH 0/7] spanning write related cleanup Wei Yang
2024-11-27 1:27 ` Wei Yang [this message]
2024-11-27 1:27 ` [PATCH 2/7] maple_tree: validate we won't split on NULL Wei Yang
2024-11-27 1:27 ` [PATCH 3/7] maple_tree: check mid_split only may have Wei Yang
2024-11-27 1:27 ` [PATCH 4/7] maple_tree: the return value of mast_spanning_rebalance() is not used Wei Yang
2024-11-27 1:27 ` [PATCH 5/7] maple_tree: the type of left subtree is already saved in bnode->type Wei Yang
2024-11-27 1:27 ` [PATCH 6/7] maple_tree: always need to update max of new left node Wei Yang
2024-11-27 1:27 ` [PATCH 7/7] maple_tree: only ascend left subtree to get the old node for replacement Wei Yang
2024-11-27 13:31 ` [PATCH 0/7] spanning write related cleanup Liam R. Howlett
2024-11-28 1:11 ` Wei Yang
2025-01-17 5:49 ` Wei Yang
2025-01-23 17:52 ` Liam R. Howlett
2025-01-24 1:43 ` Wei Yang
2025-01-27 14:36 ` Liam R. Howlett
2025-01-28 1:36 ` Wei Yang
2025-01-28 2:11 ` Wei Yang
2025-01-31 16:46 ` Wei Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241127012753.3393-2-richard.weiyang@gmail.com \
--to=richard.weiyang@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=maple-tree@lists.infradead.org \
--cc=sidhartha.kumar@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.