lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1638096766.3elxdzb8ly.astroid@bobo.none>
Date:   Sun, 28 Nov 2021 21:08:41 +1000
From:   Nicholas Piggin <npiggin@...il.com>
To:     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>,
        Yury Norov <yury.norov@...il.com>
Subject: Re: [PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ