[PATCH 7/9] maple_tree: Delete redundant code in mas_next_node()

Peng Zhang zhangpeng.00 at bytedance.com
Wed Apr 26 04:43:46 PDT 2023


在 2023/4/26 00:45, Liam R. Howlett 写道:
> * Peng Zhang <zhangpeng.00 at bytedance.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 at bytedance.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/



More information about the maple-tree mailing list