From: Sven Schnelle <svens@linux.ibm.com>
To: Yury Norov <yury.norov@gmail.com>
Cc: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"David Laight" <David.Laight@aculab.com>,
"Joe Perches" <joe@perches.com>,
"Dennis Zhou" <dennis@kernel.org>,
"Emil Renner Berthing" <kernel@esmil.dk>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Matti Vaittinen" <matti.vaittinen@fi.rohmeurope.com>,
"Alexey Klimov" <aklimov@redhat.com>,
linux-kernel@vger.kernel.org,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Thomas Richter" <tmricht@linux.ibm.com>,
"Sumanth Korikkar" <sumanthk@linux.ibm.com>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Jiapeng Chong" <jiapeng.chong@linux.alibaba.com>,
"kernel test robot" <lkp@intel.com>,
linux-s390@vger.kernel.org
Subject: Re: [PATCH 39/49] arch/s390: replace cpumask_weight with cpumask_weight_eq where appropriate
Date: Fri, 11 Feb 2022 07:54:26 +0100 [thread overview]
Message-ID: <yt9dwni17v19.fsf@linux.ibm.com> (raw)
In-Reply-To: <20220210224933.379149-40-yury.norov@gmail.com> (Yury Norov's message of "Thu, 10 Feb 2022 14:49:23 -0800")
Hi Yury,
Yury Norov <yury.norov@gmail.com> writes:
> cfset_all_start() calls cpumask_weight() to compare the weight of cpumask
> with a given number. We can do it more efficiently with
> cpumask_weight_{eq, ...} because conditional cpumask_weight may stop
> traversing the cpumask earlier, as soon as condition is (or can't be) met.
>
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
> ---
> arch/s390/kernel/perf_cpum_cf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
> index ee8707abdb6a..4d217f7f5ccf 100644
> --- a/arch/s390/kernel/perf_cpum_cf.c
> +++ b/arch/s390/kernel/perf_cpum_cf.c
> @@ -975,7 +975,7 @@ static int cfset_all_start(struct cfset_request *req)
> return -ENOMEM;
> cpumask_and(mask, &req->mask, cpu_online_mask);
> on_each_cpu_mask(mask, cfset_ioctl_on, &p, 1);
> - if (atomic_read(&p.cpus_ack) != cpumask_weight(mask)) {
> + if (!cpumask_weight_eq(mask, atomic_read(&p.cpus_ack))) {
> on_each_cpu_mask(mask, cfset_ioctl_off, &p, 1);
> rc = -EIO;
> debug_sprintf_event(cf_dbg, 4, "%s CPUs missing", __func__);
given that you're adding a bunch of these functions - gt,lt,eq and
others, i wonder whether it makes sense to also add cpumask_weight_ne(),
so one could just write:
if (cpumask_weight_ne(mask, atomic_read(&p.cpus_ack))) {
...
}
?
/Sven
next prev parent reply other threads:[~2022-02-11 6:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220210224933.379149-1-yury.norov@gmail.com>
2022-02-10 22:49 ` [PATCH 39/49] arch/s390: replace cpumask_weight with cpumask_weight_eq where appropriate Yury Norov
2022-02-11 6:54 ` Sven Schnelle [this message]
2022-02-11 23:40 ` 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=yt9dwni17v19.fsf@linux.ibm.com \
--to=svens@linux.ibm.com \
--cc=David.Laight@aculab.com \
--cc=agordeev@linux.ibm.com \
--cc=aklimov@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bigeasy@linutronix.de \
--cc=borntraeger@linux.ibm.com \
--cc=dennis@kernel.org \
--cc=gor@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=hca@linux.ibm.com \
--cc=jiapeng.chong@linux.alibaba.com \
--cc=joe@perches.com \
--cc=kernel@esmil.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=lkp@intel.com \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mirq-linux@rere.qmqm.pl \
--cc=npiggin@gmail.com \
--cc=peterz@infradead.org \
--cc=sumanthk@linux.ibm.com \
--cc=tmricht@linux.ibm.com \
--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