From: Dennis Zhou <dennis@kernel.org>
To: Yury Norov <yury.norov@gmail.com>
Cc: Joe Perches <joe@perches.com>,
linux-kernel@vger.kernel.org,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Alexey Klimov <aklimov@redhat.com>,
Amitkumar Karwar <amitkarwar@gmail.com>,
Andi Kleen <ak@linux.intel.com>, Andrew Lunn <andrew@lunn.ch>,
Andrew Morton <akpm@linux-foundation.org>,
Andy Gross <agross@kernel.org>, Andy Lutomirski <luto@kernel.org>,
Andy Shevchenko <andy@infradead.org>,
Anup Patel <anup.patel@wdc.com>, Ard Biesheuvel <ardb@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Arnd Bergmann <arnd@arndb.de>, Borislav Petkov <bp@alien8.de>,
Ca
Subject: Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}
Date: Sun, 28 Nov 2021 12:54:00 -0500 [thread overview]
Message-ID: <YaPCOPqpI/oKrTXl@fedora> (raw)
In-Reply-To: <20211128174320.GA304543@lapt>
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.
Thanks,
Dennis
WARNING: multiple messages have this Message-ID (diff)
From: Dennis Zhou <dennis@kernel.org>
To: Yury Norov <yury.norov@gmail.com>
Cc: Joe Perches <joe@perches.com>,
linux-kernel@vger.kernel.org,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Alexey Klimov <aklimov@redhat.com>,
Amitkumar Karwar <amitkarwar@gmail.com>,
Andi Kleen <ak@linux.intel.com>, Andrew Lunn <andrew@lunn.ch>,
Andrew Morton <akpm@linux-foundation.org>,
Andy Gross <agross@kernel.org>, Andy Lutomirski <luto@kernel.org>,
Andy Shevchenko <andy@infradead.org>,
Anup Patel <anup.patel@wdc.com>, Ard Biesheuvel <ardb@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Arnd Bergmann <arnd@arndb.de>, Borislav Petkov <bp@alien8.de>,
Catalin Marinas <catalin.marinas@arm.com>,
Christoph Hellwig <hch@lst.de>, Christoph Lameter <cl@linux.com>,
Daniel Vetter <daniel@ffwll.ch>,
Dave Hansen <dave.hansen@linux.intel.com>,
David Airlie <airlied@linux.ie>,
David Laight <David.Laight@aculab.com>,
Dennis Zhou <dennis@kernel.org>,
Dinh Nguyen <dinguyen@kernel.org>,
Geetha sowjanya <gakula@marvell.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Guo Ren <guoren@kernel.org>, Hans de Goede <hdegoede@redhat.com>,
Heiko Carstens <hca@linux.ibm.com>,
Ian Rogers <irogers@google.com>, Ingo Molnar <mingo@redhat.com>,
Jakub Kicinski <kuba@kernel.org>,
Jason Wessel <jason.wessel@windriver.com>,
Jens Axboe <axboe@fb.com>, Jiri Olsa <jolsa@redhat.com>,
Jonathan Cameron <jic23@kernel.org>,
Juri Lelli <juri.lelli@redhat.com>,
Kalle Valo <kvalo@codeaurora.org>,
Kees Cook <keescook@chromium.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
Lee Jones <lee.jones@linaro.org>, Marc Zyngier <maz@kernel.org>,
Marcin Wojtas <mw@semihalf.com>,
Mark Gross <markgross@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Matti Vaittinen <mazziesaccount@gmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Mel Gorman <mgorman@suse.de>,
Michael Ellerman <mpe@ellerman.id.au>,
Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>,
Nicholas Piggin <npiggin@gmail.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Peter Zijlstra <peterz@infradead.org>,
Petr Mladek <pmladek@suse.com>,
Randy Dunlap <rdunlap@infradead.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Roy Pledge <Roy.Pledge@nxp.com>,
Russell King <linux@armlinux.org.uk>,
Saeed Mahameed <saeedm@nvidia.com>,
Sagi Grimberg <sagi@grimberg.me>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Solomon Peachy <pizza@shaftnet.org>,
Stephen Boyd <sboyd@kernel.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Steven Rostedt <rostedt@goodmis.org>,
Subbaraya Sundeep <sbhatta@marvell.com>,
Sudeep Holla <sudeep.holla@arm.com>,
Sunil Goutham <sgoutham@marvell.com>,
Tariq Toukan <tariqt@nvidia.com>, Tejun Heo <tj@kernel.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Thomas Gleixner <tglx@linutronix.de>,
Ulf Hansson <ulf.hansson@linaro.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Vineet Gupta <vgupta@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Vivien Didelot <vivien.didelot@gmail.com>,
Vlastimil Babka <vbabka@suse.cz>, Will Deacon <will@kernel.org>,
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}
Date: Sun, 28 Nov 2021 12:54:00 -0500 [thread overview]
Message-ID: <YaPCOPqpI/oKrTXl@fedora> (raw)
In-Reply-To: <20211128174320.GA304543@lapt>
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.
Thanks,
Dennis
WARNING: multiple messages have this Message-ID (diff)
From: Dennis Zhou <dennis@kernel.org>
To: Yury Norov <yury.norov@gmail.com>
Cc: Joe Perches <joe@perches.com>,
linux-kernel@vger.kernel.org,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Alexey Klimov <aklimov@redhat.com>,
Amitkumar Karwar <amitkarwar@gmail.com>,
Andi Kleen <ak@linux.intel.com>, Andrew Lunn <andrew@lunn.ch>,
Andrew Morton <akpm@linux-foundation.org>,
Andy Gross <agross@kernel.org>, Andy Lutomirski <luto@kernel.org>,
Andy Shevchenko <andy@infradead.org>,
Anup Patel <anup.patel@wdc.com>, Ard Biesheuvel <ardb@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Arnd Bergmann <arnd@arndb.de>, Borislav Petkov <bp@alien8.de>,
Catalin Marinas <catalin.marinas@arm.com>,
Christoph Hellwig <hch@lst.de>, Christoph Lameter <cl@linux.com>,
Daniel Vetter <daniel@ffwll.ch>,
Dave Hansen <dave.hansen@linux.intel.com>,
David Airlie <airlied@linux.ie>,
David Laight <David.Laight@aculab.com>,
Dennis Zhou <dennis@kernel.org>,
Dinh Nguyen <dinguyen@kernel.org>,
Geetha sowjanya <gakula@marvell.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Guo Ren <guoren@kernel.org>, Hans de Goede <hdegoede@redhat.com>,
Heiko Carstens <hca@linux.ibm.com>,
Ian Rogers <irogers@google.com>, Ingo Molnar <mingo@redhat.com>,
Jakub Kicinski <kuba@kernel.org>,
Jason Wessel <jason.wessel@windriver.com>,
Jens Axboe <axboe@fb.com>, Jiri Olsa <jolsa@redhat.com>,
Jonathan Cameron <jic23@kernel.org>,
Juri Lelli <juri.lelli@redhat.com>,
Kalle Valo <kvalo@codeaurora.org>,
Kees Cook <keescook@chromium.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
Lee Jones <lee.jones@linaro.org>, Marc Zyngier <maz@kernel.org>,
Marcin Wojtas <mw@semihalf.com>,
Mark Gross <markgross@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Matti Vaittinen <mazziesaccount@gmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Mel Gorman <mgorman@suse.de>,
Michael Ellerman <mpe@ellerman.id.au>,
Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>,
Nicholas Piggin <npiggin@gmail.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Peter Zijlstra <peterz@infradead.org>,
Petr Mladek <pmladek@suse.com>,
Randy Dunlap <rdunlap@infradead.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Roy Pledge <Roy.Pledge@nxp.com>,
Russell King <linux@armlinux.org.uk>,
Saeed Mahameed <saeedm@nvidia.com>,
Sagi Grimberg <sagi@grimberg.me>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Solomon Peachy <pizza@shaftnet.org>,
Stephen Boyd <sboyd@kernel.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Steven Rostedt <rostedt@goodmis.org>,
Subbaraya Sundeep <sbhatta@marvell.com>,
Sudeep Holla <sudeep.holla@arm.com>,
Sunil Goutham <sgoutham@marvell.com>,
Tariq Toukan <tariqt@nvidia.com>, Tejun Heo <tj@kernel.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Thomas Gleixner <tglx@linutronix.de>,
Ulf Hansson <ulf.hansson@linaro.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Vineet Gupta <vgupta@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Vivien Didelot <vivien.didelot@gmail.com>,
Vlastimil Babka <vbabka@suse.cz>, Will Deacon <will@kernel.org>,
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}
Date: Sun, 28 Nov 2021 17:54:00 +0000 [thread overview]
Message-ID: <YaPCOPqpI/oKrTXl@fedora> (raw)
In-Reply-To: <20211128174320.GA304543@lapt>
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.
Thanks,
Dennis
WARNING: multiple messages have this Message-ID (diff)
From: Dennis Zhou <dennis@kernel.org>
To: Yury Norov <yury.norov@gmail.com>
Cc: Joe Perches <joe@perches.com>,
linux-kernel@vger.kernel.org,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Alexey Klimov <aklimov@redhat.com>,
Amitkumar Karwar <amitkarwar@gmail.com>,
Andi Kleen <ak@linux.intel.com>, Andrew Lunn <andrew@lunn.ch>,
Andrew Morton <akpm@linux-foundation.org>,
Andy Gross <agross@kernel.org>, Andy Lutomirski <luto@kernel.org>,
Andy Shevchenko <andy@infradead.org>,
Anup Patel <anup.patel@wdc.com>, Ard Biesheuvel <ardb@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Arnd Bergmann <arnd@arndb.de>, Borislav Petkov <bp@alien8.de>,
Catalin Marinas <catalin.marinas@arm.com>,
Christoph Hellwig <hch@lst.de>, Christoph Lameter <cl@linux.com>,
Daniel Vetter <daniel@ffwll.ch>,
Dave Hansen <dave.hansen@linux.intel.com>,
David Airlie <airlied@linux.ie>,
David Laight <David.Laight@aculab.com>,
Dennis Zhou <dennis@kernel.org>,
Dinh Nguyen <dinguyen@kernel.org>,
Geetha sowjanya <gakula@marvell.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Guo Ren <guoren@kernel.org>, Hans de Goede <hdegoede@redhat.com>,
Heiko Carstens <hca@linux.ibm.com>,
Ian Rogers <irogers@google.com>, Ingo Molnar <mingo@redhat.com>,
Jakub Kicinski <kuba@kernel.org>,
Jason Wessel <jason.wessel@windriver.com>,
Jens Axboe <axboe@fb.com>, Jiri Olsa <jolsa@redhat.com>,
Jonathan Cameron <jic23@kernel.org>,
Juri Lelli <juri.lelli@redhat.com>,
Kalle Valo <kvalo@codeaurora.org>,
Kees Cook <keescook@chromium.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
Lee Jones <lee.jones@linaro.org>, Marc Zyngier <maz@kernel.org>,
Marcin Wojtas <mw@semihalf.com>,
Mark Gross <markgross@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Matti Vaittinen <mazziesaccount@gmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Mel Gorman <mgorman@suse.de>,
Michael Ellerman <mpe@ellerman.id.au>,
Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>,
Nicholas Piggin <npiggin@gmail.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Peter Zijlstra <peterz@infradead.org>,
Petr Mladek <pmladek@suse.com>,
Randy Dunlap <rdunlap@infradead.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Roy Pledge <Roy.Pledge@nxp.com>,
Russell King <linux@armlinux.org.uk>,
Saeed Mahameed <saeedm@nvidia.com>,
Sagi Grimberg <sagi@grimberg.me>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Solomon Peachy <pizza@shaftnet.org>,
Stephen Boyd <sboyd@kernel.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Steven Rostedt <rostedt@goodmis.org>,
Subbaraya Sundeep <sbhatta@marvell.com>,
Sudeep Holla <sudeep.holla@arm.com>,
Sunil Goutham <sgoutham@marvell.com>,
Tariq Toukan <tariqt@nvidia.com>, Tejun Heo <tj@kernel.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Thomas Gleixner <tglx@linutronix.de>,
Ulf Hansson <ulf.hansson@linaro.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Vineet Gupta <vgupta@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Vivien Didelot <vivien.didelot@gmail.com>,
Vlastimil Babka <vbabka@suse.cz>, Will Deacon <will@kernel.org>,
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}
Date: Sun, 28 Nov 2021 12:54:00 -0500 [thread overview]
Message-ID: <YaPCOPqpI/oKrTXl@fedora> (raw)
In-Reply-To: <20211128174320.GA304543@lapt>
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.
Thanks,
Dennis
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
WARNING: multiple messages have this Message-ID (diff)
From: Dennis Zhou <dennis@kernel.org>
To: Yury Norov <yury.norov@gmail.com>
Cc: Juri Lelli <juri.lelli@redhat.com>, Andrew Lunn <andrew@lunn.ch>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Guo Ren <guoren@kernel.org>, Christoph Lameter <cl@linux.com>,
Christoph Hellwig <hch@lst.de>, Andi Kleen <ak@linux.intel.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Ingo Molnar <mingo@redhat.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Mel Gorman <mgorman@suse.de>,
Viresh Kumar <viresh.kumar@linaro.org>,
Petr Mladek <pmladek@suse.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Jens Axboe <axboe@fb.com>, Andy Lutomirski <luto@kernel.org>,
Lee Jones <lee.jones@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-crypto@vger.kernel.org, Joe Perches <joe@perches.com>,
Andrew Morton <akpm@linux-foundation.org>,
Mark Rutland <mark.rutland@arm.com>,
Anup Patel <anup.patel@wdc.com>,
linux-ia64@vger.kernel.org, David Airlie <airlied@linux.ie>,
Roy Pledge <Roy.Pledge@nxp.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Solomon Peachy <pizza@shaftnet.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
Dennis Zhou <dennis@kernel.org>,
Matti Vaittinen <mazziesaccount@gmail.com>,
linux-alpha@vger.kernel.org, Tejun Heo <tj@kernel.org>,
Kalle Valo <kvalo@codeaurora.org>,
Stephen Boyd <sboyd@kernel.org>, Tariq Toukan <tariqt@nvidia.com>,
Dinh Nguyen <dinguyen@kernel.org>,
Jonathan Cameron <jic23@kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Subbaraya Sundeep <sbhatta@marvell.com>,
Will Deacon <will@kernel.org>, Sagi Grimberg <sagi@grimberg.me>,
linux-csky@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com,
linux-arm-kernel@lists.infradead.org,
linux-snps-arc@lists.infradead.org,
Kees Cook <keescook@chromium.org>, Arnd Bergmann <arnd@arndb.de>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
Vineet Gupta <vgupta@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Mark Gross <markgross@kernel.org>, Borislav Petkov <bp@alien8.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
David Laight <David.Laight@aculab.com>,
Sudeep Holla <sudeep.holla@arm.com>,
Geetha sowjanya <gakula@marvell.com>,
Ian Rogers <irogers@google.com>,
kvm@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>,
Amitkumar Karwar <amitkarwar@gmail.com>,
linux-mm@kvack.org, linux-riscv@lists.infradead.org,
Jiri Olsa <jolsa@redhat.com>, Ard Biesheuvel <ardb@kernel.org>,
Marc Zyngier <maz@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Andy Gross <agross@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
Vivien Didelot <vivien.didelot@gmail.com>,
Sunil Goutham <sgoutham@marvell.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
linux-s390@vger.kernel.org, Alexey Klimov <aklimov@redhat.com>,
Heiko Carstens <hca@linux.ibm.com>,
Hans de Goede <hdegoede@redhat.com>,
Nicholas Piggin <npiggin@gmail.com>,
Marcin Wojtas <mw@semihalf.com>, Vlastimil Babka <vbabka@suse.cz>,
linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org,
Palmer Dabbelt <palmer@dabbelt.com>,
Daniel Vetter <daniel@ffwll.ch>,
Jason Wessel <jason.wessel@windriver.com>,
Saeed Mahameed <saeedm@nvidia.com>,
Andy Shevchenko <andy@infradead.org>
Subject: Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}
Date: Sun, 28 Nov 2021 12:54:00 -0500 [thread overview]
Message-ID: <YaPCOPqpI/oKrTXl@fedora> (raw)
In-Reply-To: <20211128174320.GA304543@lapt>
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.
Thanks,
Dennis
next prev parent reply other threads:[~2021-11-28 17:54 UTC|newest]
Thread overview: 182+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-28 3:56 [PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` [PATCH 1/9] lib/bitmap: add bitmap_weight_{eq,gt,le} Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` [PATCH 2/9] lib/bitmap: implement bitmap_{empty,full} with bitmap_weight_eq() Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` [PATCH 2/9] lib/bitmap: implement bitmap_{empty, full} " Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 4:37 ` [PATCH 2/9] lib/bitmap: implement bitmap_{empty,full} " Michał Mirosław
2021-11-28 4:37 ` Michał Mirosław
2021-11-28 4:37 ` Michał Mirosław
2021-11-28 4:37 ` Michał Mirosław
2021-11-28 4:37 ` Michał Mirosław
2021-11-28 6:27 ` Yury Norov
2021-11-28 6:27 ` Yury Norov
2021-11-28 6:27 ` Yury Norov
2021-11-28 6:27 ` Yury Norov
2021-11-28 6:27 ` Yury Norov
2021-11-28 18:10 ` Michał Mirosław
2021-11-28 18:10 ` Michał Mirosław
2021-11-28 18:10 ` Michał Mirosław
2021-11-28 18:10 ` Michał Mirosław
2021-11-28 18:10 ` Michał Mirosław
2021-11-28 18:10 ` Michał Mirosław
2021-12-14 19:43 ` Yury Norov
2021-12-14 19:43 ` [PATCH 2/9] lib/bitmap: implement bitmap_{empty, full} " Yury Norov
2021-12-14 19:43 ` Yury Norov
2021-12-14 19:43 ` Yury Norov
2021-12-14 19:43 ` [PATCH 2/9] lib/bitmap: implement bitmap_{empty,full} " Yury Norov
2021-12-14 19:43 ` Yury Norov
2021-12-15 8:40 ` David Laight
2021-12-15 8:40 ` David Laight
2021-12-15 8:40 ` David Laight
2021-12-15 8:40 ` David Laight
2021-12-15 8:40 ` David Laight
2021-12-15 8:40 ` David Laight
2021-12-15 17:45 ` Yury Norov
2021-12-15 17:45 ` [PATCH 2/9] lib/bitmap: implement bitmap_{empty, full} " Yury Norov
2021-12-15 17:45 ` Yury Norov
2021-12-15 17:45 ` Yury Norov
2021-12-15 17:45 ` [PATCH 2/9] lib/bitmap: implement bitmap_{empty,full} " Yury Norov
2021-12-15 17:45 ` Yury Norov
2021-11-28 3:56 ` [PATCH 3/9] all: replace bitmap_weigth() with bitmap_{empty,full,eq,gt,le} Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` [PATCH 3/9] all: replace bitmap_weigth() with bitmap_{empty, full, eq, gt, le} Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 4:47 ` [PATCH 3/9] all: replace bitmap_weigth() with bitmap_{empty,full,eq,gt,le} Michał Mirosław
2021-11-28 4:47 ` Michał Mirosław
2021-11-28 4:47 ` Michał Mirosław
2021-11-28 4:47 ` Michał Mirosław
2021-11-28 4:47 ` Michał Mirosław
2021-11-28 4:47 ` Michał Mirosław
2021-11-28 8:01 ` Greg Kroah-Hartman
2021-11-28 8:01 ` Greg Kroah-Hartman
2021-11-28 8:01 ` Greg Kroah-Hartman
2021-11-28 8:01 ` Greg Kroah-Hartman
2021-11-28 8:01 ` Greg Kroah-Hartman
2021-11-28 8:01 ` Greg Kroah-Hartman
2021-11-28 3:56 ` [PATCH 4/9] tools: sync bitmap_weight() usage with the kernel Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:56 ` Yury Norov
2021-11-28 3:57 ` [PATCH 5/9] lib/cpumask: add cpumask_weight_{eq,gt,le} Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` [PATCH 6/9] lib/nodemask: add nodemask_weight_{eq,gt,le} Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le} Yury Norov
2021-11-28 3:57 ` [PATCH 7/9] lib/cpumask: add num_{possible, present, active}_cpus_{eq, gt, le} Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 4:56 ` [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le} Michał Mirosław
2021-11-28 4:56 ` Michał Mirosław
2021-11-28 4:56 ` Michał Mirosław
2021-11-28 4:56 ` Michał Mirosław
2021-11-28 4:56 ` Michał Mirosław
2021-11-28 4:56 ` Michał Mirosław
2021-11-28 5:09 ` Michał Mirosław
2021-11-28 5:09 ` Michał Mirosław
2021-11-28 5:09 ` Michał Mirosław
2021-11-28 5:09 ` Michał Mirosław
2021-11-28 5:09 ` Michał Mirosław
2021-11-28 5:09 ` Michał Mirosław
2021-11-28 6:34 ` Yury Norov
2021-11-28 6:34 ` Yury Norov
2021-11-28 6:34 ` Yury Norov
2021-11-28 6:34 ` Yury Norov
2021-11-28 6:34 ` Yury Norov
2021-11-28 6:34 ` Yury Norov
2021-11-28 17:07 ` Joe Perches
2021-11-28 17:07 ` Joe Perches
2021-11-28 17:07 ` Joe Perches
2021-11-28 17:07 ` Joe Perches
2021-11-28 17:43 ` Yury Norov
2021-11-28 17:43 ` Yury Norov
2021-11-28 17:43 ` Yury Norov
2021-11-28 17:43 ` Yury Norov
2021-11-28 17:43 ` Yury Norov
2021-11-28 17:43 ` Yury Norov
2021-11-28 17:54 ` Dennis Zhou [this message]
2021-11-28 17:54 ` Dennis Zhou
2021-11-28 17:54 ` Dennis Zhou
2021-11-28 17:54 ` Dennis Zhou
2021-11-28 17:54 ` Dennis Zhou
2021-11-28 18:47 ` Yury Norov
2021-11-28 18:47 ` Yury Norov
2021-11-28 18:47 ` Yury Norov
2021-11-28 18:47 ` Yury Norov
2021-11-28 18:47 ` Yury Norov
2021-11-28 18:47 ` Yury Norov
2021-11-28 17:56 ` Emil Renner Berthing
2021-11-28 17:56 ` [PATCH 7/9] lib/cpumask: add num_{possible, present, active}_cpus_{eq, gt, le} Emil Renner Berthing
2021-11-28 17:56 ` Emil Renner Berthing
2021-11-28 17:56 ` Emil Renner Berthing
2021-11-28 17:56 ` [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le} Emil Renner Berthing
2021-11-28 17:56 ` Emil Renner Berthing
2021-11-28 17:57 ` Joe Perches
2021-11-28 17:57 ` Joe Perches
2021-11-28 17:57 ` Joe Perches
2021-11-28 17:57 ` Joe Perches
2021-11-28 17:57 ` Joe Perches
2021-11-28 17:57 ` Joe Perches
2021-11-28 17:07 ` Joe Perches
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` [PATCH 8/9] lib/nodemask: add num_node_state_eq() Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` [PATCH 9/9] MAINTAINERS: add cpumask and nodemask files to BITMAP_API Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 3:57 ` Yury Norov
2021-11-28 11:08 ` [PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage Nicholas Piggin
2021-11-28 11:08 ` Nicholas Piggin
2021-11-28 11:08 ` Nicholas Piggin
2021-11-28 23:36 ` Yury Norov
2021-11-28 23:36 ` Yury Norov
2021-11-28 23:36 ` Yury Norov
2021-11-28 23:36 ` Yury Norov
2021-11-28 23:36 ` Yury Norov
2021-11-28 23:36 ` Yury Norov
2021-11-28 11:08 ` Nicholas Piggin
2021-11-28 18:03 ` mirq-test
2021-11-28 18:05 ` Michał Mirosław
2021-11-28 18:05 ` Michał Mirosław
2021-11-28 18:05 ` Michał Mirosław
2021-11-28 18:03 ` mirq-test
2021-11-28 18:03 ` mirq-test
2021-11-28 18:03 ` mirq-test
2021-11-28 18:03 ` mirq-test
2021-11-29 6:38 ` Yury Norov
2021-11-29 6:38 ` Yury Norov
2021-11-29 6:38 ` Yury Norov
2021-11-29 6:38 ` Yury Norov
2021-11-29 6:38 ` Yury Norov
2021-11-29 6:38 ` Yury Norov
2021-11-29 16:34 ` Michał Mirosław
2021-11-29 16:34 ` Michał Mirosław
2021-11-29 16:34 ` Michał Mirosław
2021-11-29 16:34 ` Michał Mirosław
2021-11-29 16:34 ` Michał Mirosław
2021-12-02 0:31 ` Yury Norov
2021-12-02 0:31 ` Yury Norov
2021-12-02 0:31 ` Yury Norov
2021-12-02 0:31 ` Yury Norov
2021-12-02 0:31 ` Yury Norov
2021-12-02 0:31 ` Yury Norov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YaPCOPqpI/oKrTXl@fedora \
--to=dennis@kernel.org \
--cc=acme@kernel.org \
--cc=agross@kernel.org \
--cc=ak@linux.intel.com \
--cc=aklimov@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=amitkarwar@gmail.com \
--cc=andrew@lunn.ch \
--cc=andy@infradead.org \
--cc=anup.patel@wdc.com \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=jejb@linux.ibm.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=martin.petersen@oracle.com \
--cc=paulmck@kernel.org \
--cc=rafael@kernel.org \
--cc=yury.norov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.