public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: Valentin Schneider <vschneid@redhat.com>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jens Axboe <axboe@kernel.dk>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: Re: [RFC PATCH bitmap-for-next 4/4] blk_mq: Fix cpumask_check() warning in blk_mq_hctx_next_cpu()
Date: Thu, 6 Oct 2022 22:15:00 -0700	[thread overview]
Message-ID: <Yz+11DZk/pKWDF4c@yury-laptop> (raw)
In-Reply-To: <xhsmhy1ttf0ce.mognet@vschneid.remote.csb>

> >>  static int blk_mq_hctx_next_cpu(struct blk_mq_hw_ctx *hctx)
> >>  {
> >> -	bool tried = false;
> >>      int next_cpu = hctx->next_cpu;
> >>
> >>      if (hctx->queue->nr_hw_queues == 1)
> >>              return WORK_CPU_UNBOUND;
> >>
> >> -	if (--hctx->next_cpu_batch <= 0) {
> >> -select_cpu:
> >> -		next_cpu = cpumask_next_and(next_cpu, hctx->cpumask,
> >> -				cpu_online_mask);
> >> -		if (next_cpu >= nr_cpu_ids)
> >> -			next_cpu = blk_mq_first_mapped_cpu(hctx);
> >> +	if (--hctx->next_cpu_batch > 0 && cpu_online(next_cpu))
> >> +		return next_cpu;
> >> +
> >> +	next_cpu = cpumask_next_and_wrap(next_cpu, hctx->cpumask, cpu_online_mask, next_cpu, false);
> >
> > Last two parameters are simply useless. In fact, in many cases they
> > are useless for cpumask_next_wrap(). I'm working on simplifying the
> > cpumask_next_wrap() so that it would take just 2 parameters - pivot
> > point and cpumask.
> >
> > Regarding 'next' version - we already have find_next_and_bit_wrap(),
> > and I think cpumask_next_and_wrap() should use it.
> >
> 
> Oh, I had missed those, that makes more sense indeed.
> 
> > For the context: those last parameters are needed to exclude part of
> > cpumask from traversing, and to implement for-loop. Now that we have
> > for_each_cpu_wrap() based on for_each_set_bit_wrap(), it's possible
> > to remove them. I'm working on it.
> 
> Sounds good.

Hi Valentin, all,

I'd  like to share my work-in-progress for cpumask_next_wrap(). It's 
now in testing (at least, it boots on x86_64 VM).

I'd like to collect early comments on the rework. If you like it, please
align your 'and' version with this.

https://github.com/norov/linux/commits/__bitmap-for-next

Thanks,
Yury

      reply	other threads:[~2022-10-07  5:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 12:21 [RFC PATCH bitmap-for-next 0/4] lib/cpumask, blk_mq: Fix blk_mq_hctx_next_cpu() vs cpumask_check() Valentin Schneider
2022-10-06 12:21 ` [RFC PATCH bitmap-for-next 1/4] lib/cpumask: Generate cpumask_next_wrap() body with a macro Valentin Schneider
2022-10-06 12:21 ` [RFC PATCH bitmap-for-next 2/4] lib/cpumask: Fix cpumask_check() warning in cpumask_next_wrap*() Valentin Schneider
2022-10-06 12:21 ` [RFC PATCH bitmap-for-next 3/4] lib/cpumask: Introduce cpumask_next_and_wrap() Valentin Schneider
2022-10-06 12:21 ` [RFC PATCH bitmap-for-next 4/4] blk_mq: Fix cpumask_check() warning in blk_mq_hctx_next_cpu() Valentin Schneider
2022-10-06 13:50   ` Yury Norov
2022-10-06 15:17     ` Valentin Schneider
2022-10-07  5:15       ` 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=Yz+11DZk/pKWDF4c@yury-laptop \
    --to=yury.norov@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=vschneid@redhat.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