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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 373F2C433EF for ; Sun, 28 Nov 2021 17:09:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E1976B0075; Sun, 28 Nov 2021 12:08:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 28FB06B0078; Sun, 28 Nov 2021 12:08:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 131226B007B; Sun, 28 Nov 2021 12:08:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id 05F9E6B0075 for ; Sun, 28 Nov 2021 12:08:55 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id AACF318121FBF for ; Sun, 28 Nov 2021 17:08:44 +0000 (UTC) X-FDA: 78858973410.14.3E7B8DD Received: from smtprelay.hostedemail.com (smtprelay0032.hostedemail.com [216.40.44.32]) by imf26.hostedemail.com (Postfix) with ESMTP id 58F1820019D3 for ; Sun, 28 Nov 2021 17:08:43 +0000 (UTC) Received: from omf04.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id D9B6B1809019F; Sun, 28 Nov 2021 17:08:43 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf04.hostedemail.com (Postfix) with ESMTPA id 5EF1EA00041C; Sun, 28 Nov 2021 17:07:48 +0000 (UTC) Message-ID: <8f389151c39a8a5b6b31d5238cb680305225d9f2.camel@perches.com> Subject: Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le} From: Joe Perches To: Yury Norov , linux-kernel@vger.kernel.org, "James E.J. Bottomley" , "Martin K. Petersen" , "Paul E. McKenney" , "Rafael J. Wysocki" , Alexander Shishkin , Alexey Klimov , Amitkumar Karwar , Andi Kleen , Andrew Lunn , Andrew Morton , Andy Gross , Andy Lutomirski , Andy Shevchenko , Anup Patel , Ard Biesheuvel , Arnaldo Carvalho de Melo , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christoph Hellwig , Christoph Lameter , Daniel Vetter , Dave Hansen , David Airlie , David Laight , Dennis Zhou , Dinh Nguyen , Geetha sowjanya , Geert Uytterhoeven , Greg Kroah-Hartman , Guo Ren , Hans de Goede , Heiko Carstens , Ian Rogers , Ingo Molnar , Jakub Kicinski , Jason Wessel , Jens Axboe , Jiri Olsa , Jonathan Cameron , Juri Lelli , Kalle Valo , Kees Cook , Krzysztof Kozlowski , Lee Jones , Marc Zyngier , Marcin Wojtas , Mark Gross , Mark Rutland , Matti Vaittinen , Mauro Carvalho Chehab , Mel Gorman , Michael Ellerman , Mike Marciniszyn , Nicholas Piggin , Palmer Dabbelt , Peter Zijlstra , Petr Mladek , Randy Dunlap , Rasmus Villemoes , Roy Pledge , Russell King , Saeed Mahameed , Sagi Grimberg , Sergey Senozhatsky , Solomon Peachy , Stephen Boyd , Stephen Rothwell , Steven Rostedt , Subbaraya Sundeep , Sudeep Holla , Sunil Goutham , Tariq Toukan , Tejun Heo , Thomas Bogendoerfer , Thomas Gleixner , Ulf Hansson , Vincent Guittot , Vineet Gupta , Viresh Kumar , Vivien Didelot , Vlastimil Babka , Will Deacon , bcm-kernel-feedback-list@broadcom.com, kvm@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-perf-users@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-snps-arc@lists.infradead.org, linuxppc-dev@lists.ozlabs.org Date: Sun, 28 Nov 2021 09:07:52 -0800 In-Reply-To: <20211128035704.270739-8-yury.norov@gmail.com> References: <20211128035704.270739-1-yury.norov@gmail.com> <20211128035704.270739-8-yury.norov@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.4-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+NoJl8n1YyBqeqY0nk94+uRiGfczHPVi8= X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 58F1820019D3 X-Stat-Signature: ietiwz3qwcquox1aeets9uuy48friumr X-HE-Tag-Orig: 1638119268-113142 Authentication-Results: imf26.hostedemail.com; dkim=none; spf=none (imf26.hostedemail.com: domain of joe@perches.com has no SPF policy when checking 216.40.44.32) smtp.mailfrom=joe@perches.com; dmarc=none X-HE-Tag: 1638119323-932741 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, 2021-11-27 at 19:57 -0800, Yury Norov wrote: > Add num_{possible,present,active}_cpus_{eq,gt,le} and replace num_*_cpus() > with one of new functions where appropriate. This allows num_*_cpus_*() > to return earlier depending on the condition. [] > diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c [] > @@ -103,7 +103,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) > * if platform didn't set the present map already, do it now > * boot cpu is set to present already by init/main.c > */ > - if (num_present_cpus() <= 1) > + if (num_present_cpus_le(2)) > init_cpu_present(cpu_possible_mask); ? is this supposed to be 2 or 1 > diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c [] > @@ -593,7 +593,7 @@ static int __init pcc_cpufreq_init(void) > return ret; > } > > - if (num_present_cpus() > 4) { > + if (num_present_cpus_gt(4)) { > pcc_cpufreq_driver.flags |= CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING; > pr_err("%s: Too many CPUs, dynamic performance scaling disabled\n", > __func__); It looks as if the present variants should be using the same values so the _le test above with 1 changed to 2 looks odd.