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 776F8C4332F for ; Sun, 28 Nov 2021 18:47:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CCDC66B0075; Sun, 28 Nov 2021 13:47:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C7CB76B0078; Sun, 28 Nov 2021 13:47:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA7406B007B; Sun, 28 Nov 2021 13:47:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id 9AF526B0075 for ; Sun, 28 Nov 2021 13:47:32 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 61D2B8A3DB for ; Sun, 28 Nov 2021 18:47:22 +0000 (UTC) X-FDA: 78859221924.23.CC8308F Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by imf15.hostedemail.com (Postfix) with ESMTP id 9584DD0000AC for ; Sun, 28 Nov 2021 18:47:15 +0000 (UTC) Received: by mail-qv1-f41.google.com with SMTP id bu11so12326448qvb.0 for ; Sun, 28 Nov 2021 10:47:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=+5JBAVd8frUmOsccut4e882tgrn1djQ8KjHhL4/ag+E=; b=oEs9cCLNoYNdz+AbfzXoumcqnU2rFCFJ5TyCH12jj8Ix0vmr0cjhof0ocW5eqSpQbo mrHrVXqzVgn1iu3yISJ4wwf50y2BGwES4qCIZWk6z19v3s6rfhM8ODKHsnHGdu0xSYmn zutWpoWgGKrfvlhNB+FDfgo3OCF/7V6L7yaewLYpZDm48/8KLn7Bhlr/nJjgfB4Oiw7i hyEVArk/04uNSdzcAMwME+LGzw661S1XN1lrF6iOjE5r2wDmrufbwXHGBlcjc0XG2JfP D0I2JqoyhsvbiLTErDYg5FY5mgjhIpdLZ1XuQkVWsomuMWeu+IFVGskruJ1MCFhjIPEq wYYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=+5JBAVd8frUmOsccut4e882tgrn1djQ8KjHhL4/ag+E=; b=UWFOcxHc4ViBNIUO2gcPm9yPMDqCRFBha25zDaVbDIc3S/40UbtTatCD/rJfXOAbWQ AhDeI4AiKhKZ30biLSHlNQGvbx7/Q3igW1cl4bg8x3954DLgBFXemNChYdfEZl6ikR6y 8SzlrW5afsxDxZVn4WGyxlRd5YPEPTPO6YBf5VCnk5DjmxoxpddCd3Pj9cmSFvXTBqX1 nYfJey+8sBVFLc8QpcfqywLifE6nVg4r7Trui5oztIMtt//LgGchIxk/VXJ0bOt4N7Tf F+UOmjv7tK04mXrFNYRpi8eoBmWddg3vHVwbFwZiuurOd31WvksA+Gjn5YNIIqjZVTGN bqLQ== X-Gm-Message-State: AOAM5323y54HfXb67TP+9bWFdYYKeg7k+KAfQDqUBgvyL9XJvH/FYAJC JToXpBtURyXyybmWiEkZyA8= X-Google-Smtp-Source: ABdhPJy+21VmTcm+AhhPYb7MVuOfGbfxLsGp1r9C41IKKFVcOTnAXjsR8SRxKxcOFPC3Y4DL0s01XQ== X-Received: by 2002:a05:6214:2348:: with SMTP id hu8mr12230119qvb.9.1638125241136; Sun, 28 Nov 2021 10:47:21 -0800 (PST) Received: from localhost ([66.216.211.25]) by smtp.gmail.com with ESMTPSA id e13sm7457944qte.56.2021.11.28.10.47.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Nov 2021 10:47:20 -0800 (PST) Date: Sun, 28 Nov 2021 10:47:12 -0800 From: Yury Norov To: Dennis Zhou Cc: Joe Perches , 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 , 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 Subject: Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le} Message-ID: <20211128184712.GA309073@lapt> References: <20211128035704.270739-1-yury.norov@gmail.com> <20211128035704.270739-8-yury.norov@gmail.com> <8f389151c39a8a5b6b31d5238cb680305225d9f2.camel@perches.com> <20211128174320.GA304543@lapt> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 9584DD0000AC X-Stat-Signature: mcnwx3kz7kq1pekrkiqcfc4sy1jnssya Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=oEs9cCLN; spf=pass (imf15.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.219.41 as permitted sender) smtp.mailfrom=yury.norov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1638125235-626853 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 Sun, Nov 28, 2021 at 12:54:00PM -0500, Dennis Zhou wrote: > Hello, > > On Sun, Nov 28, 2021 at 09:43:20AM -0800, Yury Norov wrote: > > On Sun, Nov 28, 2021 at 09:07:52AM -0800, Joe Perches wrote: > > > 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 > > > > X <= 1 is the equivalent of X < 2. > > > > > > 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. > > > > I think the confusion comes from le meaning less than rather than lt. > Given the general convention of: lt (<), le (<=), eg (=), ge (>=), > gt (>), I'd consider renaming your le to lt. Ok, makes sense. I'll rename in v2 and add <= and >= versions.