public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: Re: [PATCH] lib/find: optimize find_*_bit_wrap
Date: Sun, 3 Dec 2023 10:25:33 -0800	[thread overview]
Message-ID: <ZWzIHRqj1h9VaLSA@yury-ThinkPad> (raw)
In-Reply-To: <ZU2Tmav832NIeJQk@yury-ThinkPad>

OK, taking in bitmap-for-next

On Thu, Nov 09, 2023 at 06:21:18PM -0800, Yury Norov wrote:
> Ping?
> 
> On Sat, Oct 28, 2023 at 12:05:29PM -0700, Yury Norov wrote:
> > When an offset is 0, there's no need to search a bitmap from the
> > beginning after the 1st search failed, because each bit has already
> > been tested.
> > 
> > Signed-off-by: Yury Norov <yury.norov@gmail.com>
> > ---
> >  include/linux/find.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/linux/find.h b/include/linux/find.h
> > index 5e4f39ef2e72..241b6d028eda 100644
> > --- a/include/linux/find.h
> > +++ b/include/linux/find.h
> > @@ -405,7 +405,7 @@ unsigned long find_next_and_bit_wrap(const unsigned long *addr1,
> >  {
> >  	unsigned long bit = find_next_and_bit(addr1, addr2, size, offset);
> >  
> > -	if (bit < size)
> > +	if (bit < size || offset == 0)
> >  		return bit;
> >  
> >  	bit = find_first_and_bit(addr1, addr2, offset);
> > @@ -427,7 +427,7 @@ unsigned long find_next_bit_wrap(const unsigned long *addr,
> >  {
> >  	unsigned long bit = find_next_bit(addr, size, offset);
> >  
> > -	if (bit < size)
> > +	if (bit < size || offset == 0)
> >  		return bit;
> >  
> >  	bit = find_first_bit(addr, offset);
> > -- 
> > 2.39.2

      reply	other threads:[~2023-12-03 18:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-28 19:05 [PATCH] lib/find: optimize find_*_bit_wrap Yury Norov
2023-11-10  2:21 ` Yury Norov
2023-12-03 18:25   ` Yury Norov [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=ZWzIHRqj1h9VaLSA@yury-ThinkPad \
    --to=yury.norov@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    /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