[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211128233627.GA323159@lapt>
Date: Sun, 28 Nov 2021 15:36:27 -0800
From: Yury Norov <yury.norov@...il.com>
To: Nicholas Piggin <npiggin@...il.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Andy Gross <agross@...nel.org>,
David Airlie <airlied@...ux.ie>,
Alexey Klimov <aklimov@...hat.com>,
Andi Kleen <ak@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Amitkumar Karwar <amitkarwar@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Andy Shevchenko <andy@...radead.org>,
Anup Patel <anup.patel@....com>,
Ard Biesheuvel <ardb@...nel.org>,
Arnd Bergmann <arnd@...db.de>, Jens Axboe <axboe@...com>,
bcm-kernel-feedback-list@...adcom.com,
Borislav Petkov <bp@...en8.de>,
Catalin Marinas <catalin.marinas@....com>,
Christoph Lameter <cl@...ux.com>,
Daniel Vetter <daniel@...ll.ch>,
Dave Hansen <dave.hansen@...ux.intel.com>,
David Laight <David.Laight@...LAB.COM>,
Dennis Zhou <dennis@...nel.org>,
Dinh Nguyen <dinguyen@...nel.org>,
Geetha sowjanya <gakula@...vell.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Guo Ren <guoren@...nel.org>,
Heiko Carstens <hca@...ux.ibm.com>,
Christoph Hellwig <hch@....de>,
Hans de Goede <hdegoede@...hat.com>,
Ian Rogers <irogers@...gle.com>,
Jason Wessel <jason.wessel@...driver.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
Jonathan Cameron <jic23@...nel.org>,
Jiri Olsa <jolsa@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Kees Cook <keescook@...omium.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
Jakub Kicinski <kuba@...nel.org>,
Kalle Valo <kvalo@...eaurora.org>, kvm@...r.kernel.org,
Lee Jones <lee.jones@...aro.org>, linux-alpha@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Russell King <linux@...linux.org.uk>,
linux-crypto@...r.kernel.org, linux-csky@...r.kernel.org,
linux-ia64@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org, linux-mm@...ck.org,
linux-perf-users@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
Rasmus Villemoes <linux@...musvillemoes.dk>,
linux-riscv@...ts.infradead.org, linux-s390@...r.kernel.org,
linux-snps-arc@...ts.infradead.org,
Andy Lutomirski <luto@...nel.org>,
Mark Gross <markgross@...nel.org>,
Mark Rutland <mark.rutland@....com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Marc Zyngier <maz@...nel.org>,
Matti Vaittinen <mazziesaccount@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Mel Gorman <mgorman@...e.de>,
Mike Marciniszyn <mike.marciniszyn@...nelisnetworks.com>,
Ingo Molnar <mingo@...hat.com>,
Michael Ellerman <mpe@...erman.id.au>,
Marcin Wojtas <mw@...ihalf.com>,
Palmer Dabbelt <palmer@...belt.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Solomon Peachy <pizza@...ftnet.org>,
Petr Mladek <pmladek@...e.com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Randy Dunlap <rdunlap@...radead.org>,
Steven Rostedt <rostedt@...dmis.org>,
Roy Pledge <Roy.Pledge@....com>,
Saeed Mahameed <saeedm@...dia.com>,
Sagi Grimberg <sagi@...mberg.me>,
Subbaraya Sundeep <sbhatta@...vell.com>,
Stephen Boyd <sboyd@...nel.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Sunil Goutham <sgoutham@...vell.com>,
Sudeep Holla <sudeep.holla@....com>,
Tariq Toukan <tariqt@...dia.com>,
Thomas Gleixner <tglx@...utronix.de>,
Tejun Heo <tj@...nel.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Ulf Hansson <ulf.hansson@...aro.org>,
Vlastimil Babka <vbabka@...e.cz>,
Vineet Gupta <vgupta@...nel.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
Viresh Kumar <viresh.kumar@...aro.org>,
Vivien Didelot <vivien.didelot@...il.com>,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage
On Sun, Nov 28, 2021 at 09:08:41PM +1000, Nicholas Piggin wrote:
> Excerpts from Yury Norov's message of November 28, 2021 1:56 pm:
> > In many cases people use bitmap_weight()-based functions like this:
> >
> > if (num_present_cpus() > 1)
> > do_something();
> >
> > This may take considerable amount of time on many-cpus machines because
> > num_present_cpus() will traverse every word of underlying cpumask
> > unconditionally.
> >
> > We can significantly improve on it for many real cases if stop traversing
> > the mask as soon as we count present cpus to any number greater than 1:
> >
> > if (num_present_cpus_gt(1))
> > do_something();
> >
> > To implement this idea, the series adds bitmap_weight_{eq,gt,le}
> > functions together with corresponding wrappers in cpumask and nodemask.
>
> There would be no change to callers if you maintain counters like what
> is done for num_online_cpus() today. Maybe some fixes to arch code that
> does not use set_cpu_possible() etc APIs required, but AFAIKS it would
> be better to fix such cases anyway.
Thanks, Nick. I'll try to do this.
Powered by blists - more mailing lists