Linux-csky Archive mirror
 help / color / mirror / Atom feed
From: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
To: Yury Norov <yury.norov@gmail.com>
Cc: linux-kernel@vger.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 05:56:51 +0100	[thread overview]
Message-ID: <YaMME60Jfiz5BeJF@qmqm.qmqm.pl> (raw)
In-Reply-To: <20211128035704.270739-8-yury.norov@gmail.com>

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. 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.

Best Regards
Michał Mirosław

  reply	other threads:[~2021-11-28  4:58 UTC|newest]

Thread overview: 34+ 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 ` [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  4:37   ` 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
2021-11-28  3:56 ` [PATCH 3/9] all: replace bitmap_weigth() with bitmap_{empty,full,eq,gt,le} Yury Norov
2021-11-28  4:47   ` Michał Mirosław
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: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  4:56   ` Michał Mirosław [this message]
2021-11-28  5:09     ` Michał Mirosław
2021-11-28  6:34     ` Yury Norov
2021-11-28 17:07   ` Joe Perches
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  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
2021-11-28 11:08 ` [PATCH 0/9] lib/bitmap: optimize bitmap_weight() usage Nicholas Piggin
2021-11-28 23:36   ` Yury Norov
2021-11-28 18:03 ` mirq-test
2021-11-28 18:05   ` Michał Mirosław
2021-11-29  6:38   ` Yury Norov
2021-11-29 16:34     ` Michał Mirosław
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=YaMME60Jfiz5BeJF@qmqm.qmqm.pl \
    --to=mirq-linux@rere.qmqm.pl \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-csky@vger.kernel.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).