linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Snild Dolkow <snild@sony.com>
To: Peng Zhang <zhangpeng.00@bytedance.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Stable@vger.kernel.org, maple-tree@lists.infradead.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/2] maple_tree: Fix mas_skip_node() end slot detection
Date: Tue, 7 Mar 2023 15:30:24 +0100	[thread overview]
Message-ID: <73971153-b46e-0332-aa4a-0dbe0a59fd22@sony.com> (raw)
In-Reply-To: <cec2dec7-818a-b32c-3ad4-8b23fc1351f3@bytedance.com>

On 2023-03-07 14:05, Peng Zhang wrote:
> Hi, Liam,
>> -    } while (slot > slot_count);
>> +    } while (mas->offset >= mas_data_end(mas));
>> -    mas->offset = ++slot;
>> +    mt = mte_node_type(mas->node);
>>       pivots = ma_pivots(mas_mn(mas), mt);
>> -    if (slot > 0)
>> -        mas->min = pivots[slot - 1] + 1;
>> -
>> -    if (slot <= slot_count)
>> -        mas->max = pivots[slot];
>> +    mas->min = pivots[mas->offset] + 1;
>> +    mas->offset++;
>> +    if (mas->offset < mt_slots[mt])
>> +        mas->max = pivots[mas->offset];
> There is a bug here, the assignment of mas->min and mas->max is wrong.
> The assignment will make them represent the range of a child node, but 
> it should represent the range of the current node. After mas_ascend() 
> returns, mas-min and mas->max already represent the range of the current 
> node, so we should delete these assignments of mas->min and mas->max.


Thanks for your suggestion, Peng. Applying it literally by removing only 
the min/max assignments:

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 6fc1ad42b409..9b6e581cf83f 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -5118,10 +5118,7 @@ static inline bool mas_skip_node

         mt = mte_node_type(mas->node);
         pivots = ma_pivots(mas_mn(mas), mt);
-       mas->min = pivots[mas->offset] + 1;
         mas->offset++;
-       if (mas->offset < mt_slots[mt])
-               mas->max = pivots[mas->offset];

         return true;
  }


This allowed my test to pass 100/100 runs. Still in qemu with the test 
as init, so not really stressed in any way except that specific usecase.

//Snild


  reply	other threads:[~2023-03-07 14:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03  2:15 Liam R. Howlett
2023-03-03  2:15 ` [PATCH 2/2] test_maple_tree: Add more testing for mas_empty_area() Liam R. Howlett
2023-03-03  8:51 ` [PATCH 1/2] maple_tree: Fix mas_skip_node() end slot detection Snild Dolkow
2023-03-07 13:05 ` Peng Zhang
2023-03-07 14:30   ` Snild Dolkow [this message]
2023-03-07 16:10     ` Liam R. Howlett
2023-03-07 16:16     ` Peng Zhang
2023-03-07 16:21       ` Peng Zhang
2023-03-07 16:29         ` Liam R. Howlett

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=73971153-b46e-0332-aa4a-0dbe0a59fd22@sony.com \
    --to=snild@sony.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=Stable@vger.kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=zhangpeng.00@bytedance.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