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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4DCCC433F5 for ; Fri, 11 Feb 2022 10:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+5CdDvc6u3wExj22UMMNX3mcV9I3MFs+AvszAu5ZAv0=; b=m3z+bkXuiWU83g kdDW/bkk7yDQKQ0wujnLe4PY7SDX2IkUQ9GKkdnEn/s6IGeSfZUqheYzfQBk/jh66+BI5Mmj60mKD iFtbfIu516paLQGSq5EHWz7zOY0Fsfk05FCvLV78emVG8eZwqm5+dTypYc2LhpIC4smXal+TpkOiF BizStaxBuqjda0DLogTFk3HX8jEqh1MxVX+KprOUgDqCqapeaJm931Fu2CyKy+aDST2039YDS6GjG vQOc9XWTlI9TzwEg4FV3zmuWGvHm12cL9plNH7UsXjKoR9waJtv/JZ4s5nLfhTGLi8LW9q/wmfbt5 tagHQlvJG8mkLvntHBow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nITDx-006ZOI-O4; Fri, 11 Feb 2022 10:32:21 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nITDs-006ZMe-TX for linux-arm-kernel@lists.infradead.org; Fri, 11 Feb 2022 10:32:18 +0000 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-Disposition: inline In-Reply-To: <20220210224933.379149-41-yury.norov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220211_023217_035395_F9DFE235 X-CRM114-Status: GOOD ( 16.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel