From: Valentin Schneider <vschneid@redhat.com>
To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>, Yury Norov <yury.norov@gmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>
Subject: [PATCH bitmap-for-next 0/5] bitmap,cpumask: Add for_each_cpu_andnot()
Date: Mon, 3 Oct 2022 16:34:15 +0100 [thread overview]
Message-ID: <20221003153420.285896-1-vschneid@redhat.com> (raw)
As suggested by Yury, this is the bitmap/cpumask specific bits of [1]. This now
also contains an extra fix for blk_mq.
This is based on top of Yury's bitmap-for-next [2].
A note on treewide use of for_each_cpu_andnot()
===============================================
I've used the below coccinelle script to find places that could be patched (I
couldn't figure out the valid syntax to patch from coccinelle itself):
,-----
@tmpandnot@
expression tmpmask;
iterator for_each_cpu;
position p;
statement S;
@@
cpumask_andnot(tmpmask, ...);
...
(
for_each_cpu@p(..., tmpmask, ...)
S
|
for_each_cpu@p(..., tmpmask, ...)
{
...
}
)
@script:python depends on tmpandnot@
p << tmpandnot.p;
@@
coccilib.report.print_report(p[0], "andnot loop here")
'-----
Which yields (against c40e8341e3b3):
.//arch/powerpc/kernel/smp.c:1587:1-13: andnot loop here
.//arch/powerpc/kernel/smp.c:1530:1-13: andnot loop here
.//arch/powerpc/kernel/smp.c:1440:1-13: andnot loop here
.//arch/powerpc/platforms/powernv/subcore.c:306:2-14: andnot loop here
.//arch/x86/kernel/apic/x2apic_cluster.c:62:1-13: andnot loop here
.//drivers/acpi/acpi_pad.c:110:1-13: andnot loop here
.//drivers/cpufreq/armada-8k-cpufreq.c:148:1-13: andnot loop here
.//drivers/cpufreq/powernv-cpufreq.c:931:1-13: andnot loop here
.//drivers/net/ethernet/sfc/efx_channels.c:73:1-13: andnot loop here
.//drivers/net/ethernet/sfc/siena/efx_channels.c:73:1-13: andnot loop here
.//kernel/sched/core.c:345:1-13: andnot loop here
.//kernel/sched/core.c:366:1-13: andnot loop here
.//net/core/dev.c:3058:1-13: andnot loop here
A lot of those are actually of the shape
for_each_cpu(cpu, mask) {
...
cpumask_andnot(mask, ...);
}
I think *some* of the powerpc ones would be a match for for_each_cpu_andnot(),
but I decided to just stick to the one obvious one in __sched_core_flip().
[1]: https://lore.kernel.org/all/20220923132527.1001870-1-vschneid@redhat.com/
[2]: https://github.com/norov/linux.git/ -b bitmap-for-next
Cheers,
Valentin
Valentin Schneider (5):
blk_mq: Fix cpumask_check() warning in blk_mq_hctx_next_cpu()
lib/find_bit: Introduce find_next_andnot_bit()
cpumask: Introduce for_each_cpu_andnot()
lib/test_cpumask: Add for_each_cpu_and(not) tests
sched/core: Merge cpumask_andnot()+for_each_cpu() into
for_each_cpu_andnot()
block/blk-mq.c | 9 +++++++--
include/linux/cpumask.h | 18 ++++++++++++++++++
include/linux/find.h | 38 ++++++++++++++++++++++++++++++++++++++
kernel/sched/core.c | 5 +----
lib/cpumask_kunit.c | 19 +++++++++++++++++++
lib/find_bit.c | 9 +++++++++
6 files changed, 92 insertions(+), 6 deletions(-)
--
2.31.1
next reply other threads:[~2022-10-03 15:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 15:34 Valentin Schneider [this message]
2022-10-03 15:34 ` [PATCH bitmap-for-next 1/5] blk_mq: Fix cpumask_check() warning in blk_mq_hctx_next_cpu() Valentin Schneider
2022-10-03 17:54 ` Yury Norov
2022-10-05 12:19 ` Valentin Schneider
2022-10-03 15:34 ` [PATCH bitmap-for-next 2/5] lib/find_bit: Introduce find_next_andnot_bit() Valentin Schneider
2022-10-03 15:34 ` [PATCH bitmap-for-next 3/5] cpumask: Introduce for_each_cpu_andnot() Valentin Schneider
2022-10-03 15:34 ` [PATCH bitmap-for-next 4/5] lib/test_cpumask: Add for_each_cpu_and(not) tests Valentin Schneider
2022-10-03 15:34 ` [PATCH bitmap-for-next 5/5] sched/core: Merge cpumask_andnot()+for_each_cpu() into for_each_cpu_andnot() Valentin Schneider
2022-10-03 18:52 ` [PATCH bitmap-for-next 0/5] bitmap,cpumask: Add for_each_cpu_andnot() Yury Norov
2022-10-06 12:58 ` Yury Norov
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=20221003153420.285896-1-vschneid@redhat.com \
--to=vschneid@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=axboe@kernel.dk \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=yury.norov@gmail.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