lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ygbz9G3DlPZYQ7Y7@yury-laptop>
Date:   Fri, 11 Feb 2022 15:40:36 -0800
From:   Yury Norov <yury.norov@...il.com>
To:     Sven Schnelle <svens@...ux.ibm.com>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Michał Mirosław <mirq-linux@...e.qmqm.pl>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Peter Zijlstra <peterz@...radead.org>,
        David Laight <David.Laight@...lab.com>,
        Joe Perches <joe@...ches.com>, Dennis Zhou <dennis@...nel.org>,
        Emil Renner Berthing <kernel@...il.dk>,
        Nicholas Piggin <npiggin@...il.com>,
        Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
        Alexey Klimov <aklimov@...hat.com>,
        linux-kernel@...r.kernel.org, Heiko Carstens <hca@...ux.ibm.com>,
        Vasily Gorbik <gor@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...ux.ibm.com>,
        Alexander Gordeev <agordeev@...ux.ibm.com>,
        Thomas Richter <tmricht@...ux.ibm.com>,
        Sumanth Korikkar <sumanthk@...ux.ibm.com>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
        kernel test robot <lkp@...el.com>, linux-s390@...r.kernel.org
Subject: Re: [PATCH 39/49] arch/s390: replace cpumask_weight with
 cpumask_weight_eq where appropriate

On Fri, Feb 11, 2022 at 07:54:26AM +0100, Sven Schnelle wrote:
> Hi Yury,
> 
> Yury Norov <yury.norov@...il.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@...il.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))) {
> 	...
> }
> 
> ?

It will have 3 users in cpumask + 1 in nodemask. I have no strong opinion
whether we need it or not. Let's see what people say.

Thanks,
Yury

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ