The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: "孙毅 (Yi Sun)" <Yi.Sun@unisoc.com>
Cc: "Yury Norov" <yury.norov@gmail.com>,
	"mina86@mina86.com" <mina86@mina86.com>,
	"279644543@qq.com" <279644543@qq.com>,
	"mnazarewicz@gmail.com" <mnazarewicz@gmail.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"akinobu.mita@gmail.com" <akinobu.mita@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tjmercier@google.com" <tjmercier@google.com>,
	"qiang.zhao@freescale.com" <qiang.zhao@freescale.com>,
	"scottwood@freescale.com" <scottwood@freescale.com>,
	"fvdl@google.com" <fvdl@google.com>,
	"tglx@kernel.org" <tglx@kernel.org>,
	"song@kernel.org" <song@kernel.org>, "hch@lst.de" <hch@lst.de>,
	"minchan@kernel.org" <minchan@kernel.org>,
	"王科 (Ke Wang)" <Ke.Wang@unisoc.com>,
	"John Stultz" <jstultz@google.com>
Subject: Re: 答复: [PATCH v5 1/2] lib: bitmap: add tests for bitmap_find_next_zero_area_off()
Date: Fri, 19 Jun 2026 10:01:04 -0400	[thread overview]
Message-ID: <ajVLoBFaWmHGXlNF@yury> (raw)
In-Reply-To: <cf3b9ed0197040aa8d224715a1707a8c@BJMBX02.spreadtrum.com>

On Thu, Jun 18, 2026 at 12:44:19PM +0000, 孙毅 (Yi Sun) wrote:
> 
> > > > +     expect_eq_uint(1,
> > > > +             !!(bitmap_find_next_zero_area_off(bmap, 192, 0, 33, 0, 0) > 192));
> > >
> > > It should be >= here.
> > 
> > There would be a problem if the return value equals 192.
> > size = 192;
> > if (end > size)
> > 	return end;
> > So the return value must be greater than 192.
> 
> I agree with the patch you suggested that returns the size, so it needs to be changed to >= here.

The valid index range is 0...(size-1), i.e. for 10-bits bitmap the
highest valid index is 9. If your implementation never returns 'size',
it doesn't mean that the test should consider 'size' as a valid index.

(I'm not even sure that your implementation never returns 'size').

> > > > +}
> > > > +
> > > >  static void __init test_fill_set(void)
> > > >  {
> > > >       DECLARE_BITMAP(bmap, 1024);
> > > > @@ -1559,6 +1596,7 @@ static void __init selftest(void)
> > > >       test_for_each_clear_bitrange_from();
> > > >       test_for_each_set_clump8();
> > > >       test_for_each_set_bit_wrap();
> > > > +     test_bitmap_find_next_zero_area_off();
> > > >  }
> > > >
> > > >  KSTM_MODULE_LOADERS(test_bitmap);
> > > > --
> > > > 2.34.1

  reply	other threads:[~2026-06-19 14:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18  1:52 [PATCH v5 0/2] Improve the performance of bitmap_find_next_zero_area_off() Yi Sun
2026-06-18  1:52 ` [PATCH v5 1/2] lib: bitmap: add tests for bitmap_find_next_zero_area_off() Yi Sun
2026-06-18  5:48   ` Yury Norov
2026-06-18  9:43     ` 答复: " 孙毅 (Yi Sun)
2026-06-18 12:44     ` 孙毅 (Yi Sun)
2026-06-19 14:01       ` Yury Norov [this message]
2026-06-18  1:52 ` [PATCH v5 2/2] lib: bitmap: optimize bitmap_find_next_zero_area_off() Yi Sun
2026-06-18  6:14   ` Yury Norov
2026-06-18  9:29     ` 答复: " 孙毅 (Yi Sun)

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=ajVLoBFaWmHGXlNF@yury \
    --to=yury.norov@gmail.com \
    --cc=279644543@qq.com \
    --cc=Ke.Wang@unisoc.com \
    --cc=Yi.Sun@unisoc.com \
    --cc=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=fvdl@google.com \
    --cc=hch@lst.de \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mina86@mina86.com \
    --cc=minchan@kernel.org \
    --cc=mnazarewicz@gmail.com \
    --cc=qiang.zhao@freescale.com \
    --cc=scottwood@freescale.com \
    --cc=song@kernel.org \
    --cc=tglx@kernel.org \
    --cc=tjmercier@google.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