linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vernon Yang <vernon2gm@gmail.com>
To: Liam Howlett <liam.howlett@oracle.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 8/8] maple_tree: refine mab_calc_split function
Date: Wed, 21 Dec 2022 13:18:10 +0800	[thread overview]
Message-ID: <Y6KWzfPrFIBh8kAj@vernon-pc> (raw)
In-Reply-To: <20221220150550.y5kknqwjc7q5bv75@revolver>

On Tue, Dec 20, 2022 at 03:05:52PM +0000, Liam Howlett wrote:
> * Vernon Yang <vernon2gm@gmail.com> [221220 09:26]:
> > Invert the conditional judgment of the mid_split, to focus
> > the return statement in the last statement, which is easier
> > to understand and for better readability.
> >
> > Signed-off-by: Vernon Yang <vernon2gm@gmail.com>
> > ---
> >  lib/maple_tree.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> > index 16cdcf309e97..d147669fb99c 100644
> > --- a/lib/maple_tree.c
> > +++ b/lib/maple_tree.c
> > @@ -1882,10 +1882,9 @@ static inline int mab_calc_split(struct ma_state *mas,
> >
> >  	/* Avoid ending a node on a NULL entry */
> >  	split = mab_no_null_split(bn, split, slot_count);
> > -	if (!(*mid_split))
> > -		return split;
> >
> > -	*mid_split = mab_no_null_split(bn, *mid_split, slot_count);
> > +	if (*mid_split)
> > +		*mid_split = mab_no_null_split(bn, *mid_split, slot_count);
>
> The function is written this way because mid_split is almost always
> zero.  If you want to change this, then we should add an unlikely() to
> the if statement.
Okay,thank you very much for the suggestion, I will add
an unlikely() to the if statement.

>
> >
> >  	return split;
> >  }
> > --
> > 2.34.1
> >
> >


      reply	other threads:[~2022-12-21  5:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-20 14:25 [PATCH 1/8] maple_tree: remove extra space and blank line Vernon Yang
2022-12-20 14:26 ` [PATCH 2/8] maple_tree: remove extra return statement Vernon Yang
2022-12-20 14:26 ` [PATCH 3/8] maple_tree: use mt_node_max() instead of direct operations mt_max[] Vernon Yang
2022-12-20 14:26 ` [PATCH 4/8] maple_tree: use macro MA_ROOT_PARENT instead of number Vernon Yang
2022-12-20 14:26 ` [PATCH 5/8] maple_tree: remove the redundant code Vernon Yang
2022-12-20 14:26 ` [PATCH 6/8] maple_tree: change return type of mas_commit_b_node() Vernon Yang
2022-12-20 15:03   ` Liam Howlett
2022-12-21  5:14     ` Vernon Yang
2022-12-20 14:26 ` [PATCH 7/8] maple_tree: refine ma_state init from mas_start() Vernon Yang
2022-12-20 14:26 ` [PATCH 8/8] maple_tree: refine mab_calc_split function Vernon Yang
2022-12-20 15:05   ` Liam Howlett
2022-12-21  5:18     ` Vernon Yang [this message]

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=Y6KWzfPrFIBh8kAj@vernon-pc \
    --to=vernon2gm@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=liam.howlett@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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