Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>
- Subject: Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}
- From: Yury Norov <yury.norov@xxxxxxxxx>
- Date: Sat, 27 Nov 2021 22:34:47 -0800
- Cc: linux-kernel@xxxxxxxxxxxxxxx, "James E.J. Bottomley" <jejb@xxxxxxxxxxxxx>, "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>, "Paul E. McKenney" <paulmck@xxxxxxxxxx>, "Rafael J. Wysocki" <rafael@xxxxxxxxxx>, Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>, Alexey Klimov <aklimov@xxxxxxxxxx>, Amitkumar Karwar <amitkarwar@xxxxxxxxx>, Andi Kleen <ak@xxxxxxxxxxxxxxx>, Andrew Lunn <andrew@xxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Andy Gross <agross@xxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Andy Shevchenko <andy@xxxxxxxxxxxxx>, Anup Patel <anup.patel@xxxxxxx>, Ard Biesheuvel <ardb@xxxxxxxxxx>, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Christoph Hellwig <hch@xxxxxx>, Christoph Lameter <cl@xxxxxxxxx>, Daniel Vetter <daniel@xxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, David Airlie <airlied@xxxxxxxx>, David Laight <David.Laight@xxxxxxxxxx>, Dennis Zhou <dennis@xxxxxxxxxx>, Dinh Nguyen <dinguyen@xxxxxxxxxx>, Geetha sowjanya <gakula@xxxxxxxxxxx>, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, Hans de Goede <hdegoede@xxxxxxxxxx>, Heiko Carstens <hca@xxxxxxxxxxxxx>, Ian Rogers <irogers@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Jason Wessel <jason.wessel@xxxxxxxxxxxxx>, Jens Axboe <axboe@xxxxxx>, Jiri Olsa <jolsa@xxxxxxxxxx>, Jonathan Cameron <jic23@xxxxxxxxxx>, Juri Lelli <juri.lelli@xxxxxxxxxx>, Kalle Valo <kvalo@xxxxxxxxxxxxxx>, Kees Cook <keescook@xxxxxxxxxxxx>, Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxx>, Lee Jones <lee.jones@xxxxxxxxxx>, Marc Zyngier <maz@xxxxxxxxxx>, Marcin Wojtas <mw@xxxxxxxxxxxx>, Mark Gross <markgross@xxxxxxxxxx>, Mark Rutland <mark.rutland@xxxxxxx>, Matti Vaittinen <mazziesaccount@xxxxxxxxx>, Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>, Mel Gorman <mgorman@xxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Mike Marciniszyn <mike.marciniszyn@xxxxxxxxxxxxxxxxxxxx>, Nicholas Piggin <npiggin@xxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Petr Mladek <pmladek@xxxxxxxx>, Randy Dunlap <rdunlap@xxxxxxxxxxxxx>, Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>, Roy Pledge <Roy.Pledge@xxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Saeed Mahameed <saeedm@xxxxxxxxxx>, Sagi Grimberg <sagi@xxxxxxxxxxx>, Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>, Solomon Peachy <pizza@xxxxxxxxxxxx>, Stephen Boyd <sboyd@xxxxxxxxxx>, Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>, Steven Rostedt <rostedt@xxxxxxxxxxx>, Subbaraya Sundeep <sbhatta@xxxxxxxxxxx>, Sudeep Holla <sudeep.holla@xxxxxxx>, Sunil Goutham <sgoutham@xxxxxxxxxxx>, Tariq Toukan <tariqt@xxxxxxxxxx>, Tejun Heo <tj@xxxxxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ulf Hansson <ulf.hansson@xxxxxxxxxx>, Vincent Guittot <vincent.guittot@xxxxxxxxxx>, Vineet Gupta <vgupta@xxxxxxxxxx>, Viresh Kumar <viresh.kumar@xxxxxxxxxx>, Vivien Didelot <vivien.didelot@xxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>, Will Deacon <will@xxxxxxxxxx>, bcm-kernel-feedback-list@xxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-crypto@xxxxxxxxxxxxxxx, linux-csky@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx, linux-riscv@xxxxxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-snps-arc@xxxxxxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx
- In-reply-to: <YaMME60Jfiz5BeJF@qmqm.qmqm.pl>
(restore CC list)
On Sun, Nov 28, 2021 at 05:56:51AM +0100, Michał Mirosław wrote:
> On Sat, Nov 27, 2021 at 07:57:02PM -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.
> [...]
> > @@ -3193,7 +3193,7 @@ int __init pcpu_page_first_chunk(size_t reserved_size,
> >
> > /* allocate pages */
> > j = 0;
> > - for (unit = 0; unit < num_possible_cpus(); unit++) {
> > + for (unit = 0; num_possible_cpus_gt(unit); unit++) {
>
> This looks dubious.
Only this?
> The old version I could hope the compiler would call
> num_possible_cpus() only once if it's marked const or pure, but the
> alternative is going to count the bits every time making this a guaranteed
> O(n^2) even though the bitmap doesn't change.
num_possible_cpus() is not const neither pure. This is O(n^2) before and after.
- Prev by Date:
Re: [PATCH 2/9] lib/bitmap: implement bitmap_{empty,full} with bitmap_weight_eq()
- Next by Date:
Re: [PATCH 3/9] all: replace bitmap_weigth() with bitmap_{empty,full,eq,gt,le}
- Previous by thread:
Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}
- Next by thread:
Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}
- Index(es):
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]