linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: akpm@linux-foundation.org, maple-tree@lists.infradead.org,
	linux-mm@kvack.org
Subject: Re: [PATCH] maple_tree: use xa_is_internal() for better reading
Date: Thu, 8 Aug 2024 12:53:55 -0400	[thread overview]
Message-ID: <2owp7odt4ryc42fzbtbxw6fg7zrkfi5g7tptyy4hgjpzqsthy2@46gbf75ibmz6> (raw)
In-Reply-To: <20240808043717.10930-1-richard.weiyang@gmail.com>

* Wei Yang <richard.weiyang@gmail.com> [240808 00:38]:
> If entry is a special case, we need to expand root to store it. This
> case is exactly the case of xa_is_internal().
> 
> Let's use xa_is_internal() for the check, which is friendly for
> audience.

Nack

This check is to see if it will be detected as an internal node - this
much is correct.

But changing the check to use this function reads far worse than what
exists today.  If you look at the code below, it seems to indicate that
the internal entry is being inserted into the tree - but it's not an
internal entry, it's an entry that would be detected as an internal
entry.

This is not friendlier for the audience, it's confusing.


> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> ---
>  lib/maple_tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index aa3a5df15b8e..d39b0bceb802 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -3515,7 +3515,7 @@ static inline void mas_store_root(struct ma_state *mas, void *entry)
>  {
>  	if (likely((mas->last != 0) || (mas->index != 0)))
>  		mas_root_expand(mas, entry);
> -	else if (((unsigned long) (entry) & 3) == 2)
> +	else if (xa_is_internal(entry))
>  		mas_root_expand(mas, entry);
>  	else {
>  		rcu_assign_pointer(mas->tree->ma_root, entry);
> -- 
> 2.34.1
> 


       reply	other threads:[~2024-08-08 16:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240808043717.10930-1-richard.weiyang@gmail.com>
2024-08-08 16:53 ` Liam R. Howlett [this message]
2024-08-09  1:58   ` Wei Yang
2024-08-09 14:16     ` 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=2owp7odt4ryc42fzbtbxw6fg7zrkfi5g7tptyy4hgjpzqsthy2@46gbf75ibmz6 \
    --to=liam.howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=richard.weiyang@gmail.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