linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] maple_tree: root node could be handled by !p_slot too
@ 2024-09-13  6:31 Wei Yang
  2024-09-13 14:17 ` Liam R. Howlett
  2024-10-15  1:13 ` Liam R. Howlett
  0 siblings, 2 replies; 6+ messages in thread
From: Wei Yang @ 2024-09-13  6:31 UTC (permalink / raw)
  To: akpm, Liam.Howlett; +Cc: maple-tree, linux-mm, Wei Yang, Liam R . Howlett

For a root node, mte_parent_slot() return 0, this exactly fits the
following !p_slot check.

So we can remove the special handling for root node.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
---
 lib/maple_tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 85bd651e7770..b5dde94cc7a9 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -2100,9 +2100,7 @@ static inline bool mas_prev_sibling(struct ma_state *mas)
 {
 	unsigned int p_slot = mte_parent_slot(mas->node);
 
-	if (mte_is_root(mas->node))
-		return false;
-
+	/* For root node, p_slot is set to 0 by mte_parent_slot(). */
 	if (!p_slot)
 		return false;
 
-- 
2.34.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] maple_tree: root node could be handled by !p_slot too
  2024-09-13  6:31 [PATCH] maple_tree: root node could be handled by !p_slot too Wei Yang
@ 2024-09-13 14:17 ` Liam R. Howlett
  2024-10-13 14:41   ` Wei Yang
  2024-10-15  1:13 ` Liam R. Howlett
  1 sibling, 1 reply; 6+ messages in thread
From: Liam R. Howlett @ 2024-09-13 14:17 UTC (permalink / raw)
  To: Wei Yang; +Cc: akpm, maple-tree, linux-mm

* Wei Yang <richard.weiyang@gmail.com> [240913 02:31]:
> For a root node, mte_parent_slot() return 0, this exactly fits the
> following !p_slot check.

This sounds right, I will have to look deeper at it though.

Thanks,
Liam

> 
> So we can remove the special handling for root node.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
> ---
>  lib/maple_tree.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 85bd651e7770..b5dde94cc7a9 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -2100,9 +2100,7 @@ static inline bool mas_prev_sibling(struct ma_state *mas)
>  {
>  	unsigned int p_slot = mte_parent_slot(mas->node);
>  
> -	if (mte_is_root(mas->node))
> -		return false;
> -
> +	/* For root node, p_slot is set to 0 by mte_parent_slot(). */
>  	if (!p_slot)
>  		return false;
>  
> -- 
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] maple_tree: root node could be handled by !p_slot too
  2024-09-13 14:17 ` Liam R. Howlett
@ 2024-10-13 14:41   ` Wei Yang
  2024-10-14  2:06     ` Liam R. Howlett
  0 siblings, 1 reply; 6+ messages in thread
From: Wei Yang @ 2024-10-13 14:41 UTC (permalink / raw)
  To: Liam R. Howlett, Wei Yang, akpm, maple-tree, linux-mm

On Fri, Sep 13, 2024 at 10:17:07AM -0400, Liam R. Howlett wrote:
>* Wei Yang <richard.weiyang@gmail.com> [240913 02:31]:
>> For a root node, mte_parent_slot() return 0, this exactly fits the
>> following !p_slot check.
>
>This sounds right, I will have to look deeper at it though.
>

Hi, Liam

I guess you are back?

>Thanks,
>Liam
>
>> 
>> So we can remove the special handling for root node.
>> 
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
>> ---
>>  lib/maple_tree.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>> 
>> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
>> index 85bd651e7770..b5dde94cc7a9 100644
>> --- a/lib/maple_tree.c
>> +++ b/lib/maple_tree.c
>> @@ -2100,9 +2100,7 @@ static inline bool mas_prev_sibling(struct ma_state *mas)
>>  {
>>  	unsigned int p_slot = mte_parent_slot(mas->node);
>>  
>> -	if (mte_is_root(mas->node))
>> -		return false;
>> -
>> +	/* For root node, p_slot is set to 0 by mte_parent_slot(). */
>>  	if (!p_slot)
>>  		return false;
>>  
>> -- 
>> 2.34.1
>> 

-- 
Wei Yang
Help you, Help me


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] maple_tree: root node could be handled by !p_slot too
  2024-10-13 14:41   ` Wei Yang
@ 2024-10-14  2:06     ` Liam R. Howlett
  2024-10-14  2:49       ` Wei Yang
  0 siblings, 1 reply; 6+ messages in thread
From: Liam R. Howlett @ 2024-10-14  2:06 UTC (permalink / raw)
  To: Wei Yang; +Cc: akpm, maple-tree, linux-mm

* Wei Yang <richard.weiyang@gmail.com> [241013 10:42]:
> On Fri, Sep 13, 2024 at 10:17:07AM -0400, Liam R. Howlett wrote:
> >* Wei Yang <richard.weiyang@gmail.com> [240913 02:31]:
> >> For a root node, mte_parent_slot() return 0, this exactly fits the
> >> following !p_slot check.
> >
> >This sounds right, I will have to look deeper at it though.
> >
> 
> Hi, Liam
> 
> I guess you are back?

Yes.  I'll get to this soon.  I believe you have two sets (or three?) I
have to look at.

Thanks,
Liam

> 
> >Thanks,
> >Liam
> >
> >> 
> >> So we can remove the special handling for root node.
> >> 
> >> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> >> CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
> >> ---
> >>  lib/maple_tree.c | 4 +---
> >>  1 file changed, 1 insertion(+), 3 deletions(-)
> >> 
> >> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> >> index 85bd651e7770..b5dde94cc7a9 100644
> >> --- a/lib/maple_tree.c
> >> +++ b/lib/maple_tree.c
> >> @@ -2100,9 +2100,7 @@ static inline bool mas_prev_sibling(struct ma_state *mas)
> >>  {
> >>  	unsigned int p_slot = mte_parent_slot(mas->node);
> >>  
> >> -	if (mte_is_root(mas->node))
> >> -		return false;
> >> -
> >> +	/* For root node, p_slot is set to 0 by mte_parent_slot(). */
> >>  	if (!p_slot)
> >>  		return false;
> >>  
> >> -- 
> >> 2.34.1
> >> 
> 
> -- 
> Wei Yang
> Help you, Help me


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] maple_tree: root node could be handled by !p_slot too
  2024-10-14  2:06     ` Liam R. Howlett
@ 2024-10-14  2:49       ` Wei Yang
  0 siblings, 0 replies; 6+ messages in thread
From: Wei Yang @ 2024-10-14  2:49 UTC (permalink / raw)
  To: Liam R. Howlett, Wei Yang, akpm, maple-tree, linux-mm

On Sun, Oct 13, 2024 at 10:06:48PM -0400, Liam R. Howlett wrote:
>* Wei Yang <richard.weiyang@gmail.com> [241013 10:42]:
>> On Fri, Sep 13, 2024 at 10:17:07AM -0400, Liam R. Howlett wrote:
>> >* Wei Yang <richard.weiyang@gmail.com> [240913 02:31]:
>> >> For a root node, mte_parent_slot() return 0, this exactly fits the
>> >> following !p_slot check.
>> >
>> >This sounds right, I will have to look deeper at it though.
>> >
>> 
>> Hi, Liam
>> 
>> I guess you are back?
>
>Yes.  I'll get to this soon.  I believe you have two sets (or three?) I
>have to look at.

Thanks, I have sent other two.

While I have accumulated other changes, not sure you prefer to hold a while or
it is okay to go on.

>
>Thanks,
>Liam
>

-- 
Wei Yang
Help you, Help me


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] maple_tree: root node could be handled by !p_slot too
  2024-09-13  6:31 [PATCH] maple_tree: root node could be handled by !p_slot too Wei Yang
  2024-09-13 14:17 ` Liam R. Howlett
@ 2024-10-15  1:13 ` Liam R. Howlett
  1 sibling, 0 replies; 6+ messages in thread
From: Liam R. Howlett @ 2024-10-15  1:13 UTC (permalink / raw)
  To: Wei Yang; +Cc: akpm, maple-tree, linux-mm

* Wei Yang <richard.weiyang@gmail.com> [240913 02:31]:
> For a root node, mte_parent_slot() return 0, this exactly fits the
> following !p_slot check.
> 
> So we can remove the special handling for root node.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: Liam R. Howlett <Liam.Howlett@Oracle.com>

Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>

> ---
>  lib/maple_tree.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 85bd651e7770..b5dde94cc7a9 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -2100,9 +2100,7 @@ static inline bool mas_prev_sibling(struct ma_state *mas)
>  {
>  	unsigned int p_slot = mte_parent_slot(mas->node);
>  
> -	if (mte_is_root(mas->node))
> -		return false;
> -
> +	/* For root node, p_slot is set to 0 by mte_parent_slot(). */
>  	if (!p_slot)
>  		return false;
>  
> -- 
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-15  1:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-13  6:31 [PATCH] maple_tree: root node could be handled by !p_slot too Wei Yang
2024-09-13 14:17 ` Liam R. Howlett
2024-10-13 14:41   ` Wei Yang
2024-10-14  2:06     ` Liam R. Howlett
2024-10-14  2:49       ` Wei Yang
2024-10-15  1:13 ` Liam R. Howlett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox