linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org,
	linux-mm@kvack.org, akpm@linux-foundation.org,
	liam.howlett@oracle.com, willy@infradead.org,
	richard.weiyang@gmail.com
Subject: Re: [PATCH] maple_tree: remove conditionals to detect wr_node_store
Date: Thu, 10 Oct 2024 06:28:44 +0000	[thread overview]
Message-ID: <20241010062844.vf4pyrd6isfddwo4@master> (raw)
In-Reply-To: <20241009152007.2096-1-sidhartha.kumar@oracle.com>

On Wed, Oct 09, 2024 at 11:20:07AM -0400, Sidhartha Kumar wrote:
>From: Sidhartha <sidhartha.kumar@oracle.com>
>
>In mas_wr_store_type(), we check if new_end < mt_slots[wr_mas->type]. If
>this check fails, we know that ,after this, new_end is >= mt_min_slots.
>Checking this again when we detect a wr_node_store later in the function
>is reduntant. Because this check is part of an OR statement, the statement
>will always evaluate to true, therefore we can just get rid of it.
>
>Suggested-by; Wei Yang <richard.weiyang@gmail.com>
>Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
>---
> lib/maple_tree.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
>diff --git a/lib/maple_tree.c b/lib/maple_tree.c
>index 4b423330d83c..f5a12d37b352 100644
>--- a/lib/maple_tree.c
>+++ b/lib/maple_tree.c
>@@ -4252,14 +4252,7 @@ static inline void mas_wr_store_type(struct ma_wr_state *wr_mas)
> 		return;
> 	}
> 
>-	if (mte_is_root(mas->node) || (new_end >= mt_min_slots[wr_mas->type]) ||
>-		(mas->mas_flags & MA_STATE_BULK)) {
>-		mas->store_type = wr_node_store;
>-		return;
>-	}
>-
>-	mas->store_type = wr_invalid;
>-	MAS_WARN_ON(mas, 1);

If my understanding is correct, here is the only place we assign wr_invalid.

So maybe we can remove this definition?

>+	mas->store_type = wr_node_store;
> }
> 
> /**
>-- 
>2.43.0

-- 
Wei Yang
Help you, Help me


  parent reply	other threads:[~2024-10-10  6:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09 15:20 Sidhartha Kumar
2024-10-10  0:02 ` Liam R. Howlett
2024-10-10  1:29   ` Liam R. Howlett
2024-10-10  6:28 ` Wei Yang [this message]
2024-10-10 17: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=20241010062844.vf4pyrd6isfddwo4@master \
    --to=richard.weiyang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=liam.howlett@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=sidhartha.kumar@oracle.com \
    --cc=willy@infradead.org \
    /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