From: Wei Yang <richard.weiyang@gmail.com>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
Wei Yang <richard.weiyang@gmail.com>,
akpm@linux-foundation.org, maple-tree@lists.infradead.org,
linux-mm@kvack.org, Sidhartha Kumar <sidhartha.kumar@oracle.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Subject: Re: [PATCH 1/4] maple_tree: current split may result in deficient node
Date: Sun, 3 Nov 2024 23:47:08 +0000 [thread overview]
Message-ID: <20241103234708.opoxwhlk4zagcii5@master> (raw)
In-Reply-To: <lsrjc3ibcw2l2alcr7brpcviiqrla7icy4xbfmlh4pa6npt5ld@ug5k3xop7d5c>
On Sun, Oct 20, 2024 at 05:55:10PM -0400, Liam R. Howlett wrote:
>* Wei Yang <richard.weiyang@gmail.com> [241019 22:46]:
>> Current split would result in deficient node in rare case.
>>
>> For example:
>>
>> mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE)
>> for (count = 0; count < 10; count++) {
>> mas_set(&mas, count);
>> mas_store(&mas, xa_mk_value(count));
>> }
>>
>> for (count = 20; count < 39; count++) {
>> mas_set(&mas, count);
>> mas_store(&mas, xa_mk_value(count));
>> }
>>
>> for (count = 10; count < 12; count++) {
>> mas_set(&mas, count);
>> mas_store(&mas, xa_mk_value(count));
>> }
>> mt_validate(mt);
>>
>> The validation would report deficient node.
>
>I think you can explain it better than this?
>
>If we fill a left node with the right node being already full, the split
>of the left node will result in the new middle node being insufficient.
>
Thanks, I will put the explanation later.
>>
>> The reason is we don't leave enough room for the right node.
>
>The reason is we don't leave enough data for the node on the right of
>the split. The node on the right has too much room from what I see?
>
Too much room? Or too much empty room?
I may missed here.
>>
>> The deficient check is (end < mt_min_slot[]), which means a node must
>> have at least (mt_min_slot[] + 1) number of data. The right node's index
>> range is [split + 1, b_end], which means the number of data in right
>> node is (b_end - (split + 1) + 1) = (b_end - split).
>>
>> Then the check between the number of data and (mt_min_slot[] + 1) is
>> (b_end - split) > (mt_min_slot[] + 1), which leads to
>> (b_end - split - 1) > (mt_min_slot[]).
>
>Don't state the code, it's stated below.
Sure, will remote this part.
>
>I am still concerned about jitter that this patch set may cause.
Per my understanding, a jitter is a removal which cause a deficient node which
is just created from a split, right?
>
>>
>> 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 | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
>> index 1205a5208cfe..894dc5e9436e 100644
>> --- a/lib/maple_tree.c
>> +++ b/lib/maple_tree.c
>> @@ -1831,7 +1831,7 @@ static inline int mab_no_null_split(struct maple_big_node *b_node,
>> * still be sufficient, then increment the split on NULL.
>> */
>> if ((split < slot_count - 1) &&
>> - (b_node->b_end - split) > (mt_min_slots[b_node->type]))
>> + (b_node->b_end - split - 1) > (mt_min_slots[b_node->type]))
>> split++;
>> else
>> split--;
>> @@ -1896,7 +1896,7 @@ static inline int mab_calc_split(struct ma_state *mas,
>> */
>> while ((split < slot_count - 1) &&
>> ((bn->pivot[split] - min) < slot_count - 1) &&
>> - (b_end - split > slot_min))
>> + (b_end - split - 1 > slot_min))
>> split++;
>> }
>>
>> --
>> 2.34.1
>>
--
Wei Yang
Help you, Help me
next prev parent reply other threads:[~2024-11-03 23:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-20 2:46 [PATCH 0/4] " Wei Yang
2024-10-20 2:46 ` [PATCH 1/4] " Wei Yang
2024-10-20 21:55 ` Liam R. Howlett
2024-11-03 23:47 ` Wei Yang [this message]
2024-11-08 2:30 ` Wei Yang
2024-11-08 2:49 ` Liam R. Howlett
2024-10-20 2:46 ` [PATCH 2/4] maple_tree: add a test check " Wei Yang
2024-10-20 2:46 ` [PATCH 3/4] maple_tree: use the correct min to calculate split Wei Yang
2024-10-20 22:00 ` Liam R. Howlett
2024-10-29 17:49 ` Liam R. Howlett
2024-11-08 3:02 ` Wei Yang
2024-11-09 1:24 ` Wei Yang
2024-11-08 2:55 ` Wei Yang
2024-11-08 3:19 ` Liam R. Howlett
2024-11-09 1:40 ` Wei Yang
2024-11-09 4:01 ` Liam R. Howlett
2024-11-09 12:22 ` Wei Yang
2024-10-20 2:46 ` [PATCH 4/4] maple_tree: only root node could be deficient Wei Yang
2024-10-20 21:56 ` Liam R. Howlett
2024-11-03 23:15 ` Wei Yang
2024-10-20 20:34 ` [PATCH 0/4] maple_tree: current split may result in deficient node Liam R. Howlett
2024-10-21 1:30 ` 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=20241103234708.opoxwhlk4zagcii5@master \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox