From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA7ADC4332F for ; Fri, 11 Feb 2022 10:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348929AbiBKKcT (ORCPT ); Fri, 11 Feb 2022 05:32:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:56802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348921AbiBKKcQ (ORCPT ); Fri, 11 Feb 2022 05:32:16 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2A8EFEA9 for ; Fri, 11 Feb 2022 02:32:16 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EB8C5106F; Fri, 11 Feb 2022 02:32:15 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.87.94]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5ACEC3F73B; Fri, 11 Feb 2022 02:32:13 -0800 (PST) Date: Fri, 11 Feb 2022 10:32:05 +0000 From: Mark Rutland To: Yury Norov Cc: Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Lorenzo Pieralisi , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 40/49] firmware: pcsi: replace cpumask_weight with cpumask_weight_eq Message-ID: References: <20220210224933.379149-1-yury.norov@gmail.com> <20220210224933.379149-41-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220210224933.379149-41-yury.norov@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 With the 'pcsi' typo fixed: Acked-by: Mark Rutland 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 >