[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <19049997-7971-f39c-a466-dd4ba498a902@bytedance.com>
Date: Wed, 26 Apr 2023 19:43:46 +0800
From: Peng Zhang <zhangpeng.00@...edance.com>
To: "Liam R. Howlett" <Liam.Howlett@...cle.com>,
Peng Zhang <zhangpeng.00@...edance.com>,
akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, maple-tree@...ts.infradead.org
Subject: Re: [PATCH 7/9] maple_tree: Delete redundant code in mas_next_node()
在 2023/4/26 00:45, Liam R. Howlett 写道:
> * Peng Zhang <zhangpeng.00@...edance.com> [230425 07:05]:
>
> The title of the patch seems wrong.
>
> This isn't redundant code and you aren't deleting it.. you are moving a
> block of code outside a loop. You did modify the check though, is that
> the redundant code?
>
>> When offset == node_end is satisfied, go to the parent node, mas->max
>> will not change. So there is no need to update min on the move.
> Please try not to state the code in your commit message.
>
> I have moved this block of code in patch 27/34 [1]
>
>> Signed-off-by: Peng Zhang <zhangpeng.00@...edance.com>
>> ---
>> lib/maple_tree.c | 7 ++-----
>> 1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
>> index 83441ef2e1f57..8bfa837b7b752 100644
>> --- a/lib/maple_tree.c
>> +++ b/lib/maple_tree.c
>> @@ -4616,7 +4616,8 @@ static inline int mas_next_node(struct ma_state *mas, struct maple_node *node,
>> enum maple_type mt;
>> void __rcu **slots;
>>
>> - if (mas->max >= max)
>> + min = mas->max + 1;
>> + if (min > max)
>> goto no_entry;
> What happens on overflow?
Yes, I made a mistake.
I will drop this patch since you have updated the code in patch 27/34.
>
>>
>> level = 0;
>> @@ -4624,10 +4625,6 @@ static inline int mas_next_node(struct ma_state *mas, struct maple_node *node,
>> if (ma_is_root(node))
>> goto no_entry;
>>
>> - min = mas->max + 1;
>> - if (min > max)
>> - goto no_entry;
>> -
>> if (unlikely(mas_ascend(mas)))
>> return 1;
>>
>> --
>> 2.20.1
>>
> [1] https://lore.kernel.org/linux-mm/20230425140955.3834476-28-Liam.Howlett@oracle.com/
Powered by blists - more mailing lists