From: Yury Norov <yury.norov@gmail.com>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Andy Gross <agross@kernel.org>, David Airlie <airlied@linux.ie>,
Alexey Klimov <aklimov@redhat.com>,
Andi Kleen <ak@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Amitkumar Karwar <amitkarwar@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Andy Shevchenko <andy@infradead.org>,
Anup Patel <anup.patel@wdc.com>, Ard Biesheuvel <ardb@kernel.org>,
Arnd Bergmann <arnd@arndb.de>, Jens Axboe <axboe@fb.com>,
bcm-kernel-feedback-list@broadcom.com,
Borislav Petkov <bp@alien8.de>,
Catalin Marinas <catalin.marinas@arm.com>,
Christoph Lameter <cl@linux.com>, Daniel Vetter <daniel@ffwll.ch>,
Dave Hansen <dave.hansen@linux.intel.com>,
David Laight <David.Laight@ACULAB.COM>,
Dennis Zhou <dennis@kernel.org>,
Dinh Nguyen <dinguyen@kernel.org>,
Geetha sowjanya <gakula@marvell.com>
Subject: Re: [PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage
Date: Sun, 28 Nov 2021 15:36:27 -0800 [thread overview]
Message-ID: <20211128233627.GA323159@lapt> (raw)
In-Reply-To: <1638096766.3elxdzb8ly.astroid@bobo.none>
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.
next prev parent reply other threads:[~2021-11-28 23:36 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211128035704.270739-1-yury.norov@gmail.com>
2021-11-28 3:56 ` [PATCH 1/9] lib/bitmap: add bitmap_weight_{eq,gt,le} 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 ` [PATCH 3/9] all: replace bitmap_weigth() with bitmap_{empty,full,eq,gt,le} Yury Norov
2021-11-28 3:56 ` [PATCH 4/9] tools: sync bitmap_weight() usage with the kernel 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 ` [PATCH 6/9] lib/nodemask: add nodemask_weight_{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 ` [PATCH 8/9] lib/nodemask: add num_node_state_eq() Yury Norov
2021-11-28 3:57 ` [PATCH 9/9] MAINTAINERS: add cpumask and nodemask files to BITMAP_API Yury Norov
[not found] ` <20211128035704.270739-3-yury.norov@gmail.com>
2021-11-28 4:37 ` [PATCH 2/9] lib/bitmap: implement bitmap_{empty,full} with bitmap_weight_eq() Michał Mirosław
2021-11-28 6:27 ` Yury Norov
2021-11-28 18:10 ` Michał Mirosław
2021-12-14 19:43 ` Yury Norov
2021-12-15 8:40 ` David Laight
2021-12-15 17:45 ` Yury Norov
[not found] ` <20211128035704.270739-4-yury.norov@gmail.com>
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 8:01 ` Greg Kroah-Hartman
2021-11-28 11:08 ` [PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage Nicholas Piggin
[not found] ` <20211128035704.270739-8-yury.norov@gmail.com>
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 5:09 ` Michał Mirosław
2021-11-28 6:34 ` Yury Norov
2021-11-28 17:07 ` Joe Perches
[not found] ` <8f389151c39a8a5b6b31d5238cb680305225d9f2.camel@perches.com>
2021-11-28 17:43 ` Yury Norov
2021-11-28 17:54 ` Dennis Zhou
2021-11-28 18:47 ` Yury Norov
2021-11-28 17:56 ` Emil Renner Berthing
2021-11-28 17:57 ` Joe Perches
2021-11-28 18:03 ` [PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage mirq-test
2021-11-29 6:38 ` Yury Norov
2021-11-29 16:34 ` Michał Mirosław
2021-12-02 0:31 ` Yury Norov
[not found] ` <1638096766.3elxdzb8ly.astroid@bobo.none>
2021-11-28 23:36 ` Yury Norov [this message]
2021-11-28 3:56 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=20211128233627.GA323159@lapt \
--to=yury.norov@gmail.com \
--cc=David.Laight@ACULAB.COM \
--cc=acme@kernel.org \
--cc=agross@kernel.org \
--cc=airlied@linux.ie \
--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=axboe@fb.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=cl@linux.com \
--cc=daniel@ffwll.ch \
--cc=dave.hansen@linux.intel.com \
--cc=dennis@kernel.org \
--cc=dinguyen@kernel.org \
--cc=gakula@marvell.com \
--cc=npiggin@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).