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: <YgY7JRQtWr48PtG2@FVFF77S0Q05N>
Date:   Fri, 11 Feb 2022 10:32:05 +0000
From:   Mark Rutland <mark.rutland@....com>
To:     Yury Norov <yury.norov@...il.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,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 40/49] firmware: pcsi: replace cpumask_weight with
 cpumask_weight_eq

On Thu, Feb 10, 2022 at 02:49:24PM -0800, Yury Norov wrote:
> down_and_up_cpus() 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>

With the 'pcsi' typo fixed:

Acked-by: Mark Rutland <mark.rutland@....com>

Mark.

> ---
>  drivers/firmware/psci/psci_checker.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/psci/psci_checker.c b/drivers/firmware/psci/psci_checker.c
> index 116eb465cdb4..90c9473832a9 100644
> --- a/drivers/firmware/psci/psci_checker.c
> +++ b/drivers/firmware/psci/psci_checker.c
> @@ -90,7 +90,7 @@ static unsigned int down_and_up_cpus(const struct cpumask *cpus,
>  		 * cpu_down() checks the number of online CPUs before the TOS
>  		 * resident CPU.
>  		 */
> -		if (cpumask_weight(offlined_cpus) + 1 == nb_available_cpus) {
> +		if (cpumask_weight_eq(offlined_cpus, nb_available_cpus - 1)) {
>  			if (ret != -EBUSY) {
>  				pr_err("Unexpected return code %d while trying "
>  				       "to power down last online CPU %d\n",
> -- 
> 2.32.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ