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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Peng Zhang <zhangpeng.00@xxxxxxxxxxxxx> [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@xxxxxxxxxxxxx>
> ---
>  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?

>  
>  	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@xxxxxxxxxx/




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux