linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: Valentin Schneider <vschneid@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Dmitry Vyukov <dvyukov@google.com>,
	Sander Vanheule <sander@svanheule.net>,
	Alexey Klimov <klimov.linux@gmail.com>,
	Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH v2 0/5] cpumask: cleanup nr_cpu_ids vs nr_cpumask_bits mess
Date: Tue, 6 Sep 2022 09:26:02 -0700	[thread overview]
Message-ID: <CAAH8bW-F9e48hbimtgtmv09z7+LiC516KzN55USZZBhq3wv4OQ@mail.gmail.com> (raw)
In-Reply-To: <xhsmhv8q0bj6m.mognet@vschneid.remote.csb>

On Tue, Sep 6, 2022 at 8:45 AM Valentin Schneider <vschneid@redhat.com> wrote:
>
> On 06/09/22 16:38, Peter Zijlstra wrote:
> > On Tue, Sep 06, 2022 at 01:06:47PM +0100, Valentin Schneider wrote:
> >
> >>   #define nr_cpumask_bits nr_cpu_ids
> >
> > That assumes the CPU space is dense; is this so? That is, you can have 4
> > CPUs while the highest cpu number is vastly larger than 4.

It's quite common. One can configure qemu to give to the user one cpu at
start, and hotplug more on demand. In that case those unattached CPUS
are set in cpu_possible_mask.

> > It's uncommon, but not unheard of I think. ISTR some BIOSes leaving
> > holes in the CPU space when there were empty CPU sockets on the
> > motherboard.

Didn't get my hands on that particular board, but I suspect that those missed
CPUs will be set in possible mask, and unset in present, online and active
masks.

> I'd assume this would be visible in the cpu_possible_mask and thus be
> properly reflected in nr_cpu_ids. Otherwise that would already break with
> CONFIG_CPUMASK_OFFSTACK=y, I think.

Yes.

The nr_cpu_ids is set as:
  find_last_bit(cpumask_bits(cpu_possible_mask), NR_CPUS) + 1

For all board and VM configurations I've been working with, the
cpu_possible_mask
was dense up to nr_cpu_ids.The holes that may appear if HOTPLUG is enabled
or by any other reason are all in the present mask, and therefore
nr_cpu_ids is set
correctly.

  reply	other threads:[~2022-09-06 16:46 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05 23:08 [PATCH v2 0/5] cpumask: cleanup nr_cpu_ids vs nr_cpumask_bits mess Yury Norov
2022-09-05 23:08 ` [PATCH v2 1/5] smp: don't declare nr_cpu_ids if NR_CPUS == 1 Yury Norov
2022-09-06  8:53   ` Peter Zijlstra
2022-09-06 14:06     ` Yury Norov
2022-09-06 14:36       ` Peter Zijlstra
2022-09-06 15:01         ` Andy Shevchenko
2022-09-06 17:53           ` Peter Zijlstra
2022-09-06 15:07         ` Yury Norov
2022-09-07  8:02         ` David Laight
2022-09-05 23:08 ` [PATCH v2 2/5] smp: add set_nr_cpu_ids() Yury Norov
2022-09-05 23:08 ` [PATCH v2 3/5] lib/cpumask: delete misleading comment Yury Norov
2022-09-05 23:08 ` [PATCH v2 4/5] lib/cpumask: deprecate nr_cpumask_bits Yury Norov
2022-09-05 23:08 ` [PATCH v2 5/5] lib/cpumask: add FORCE_NR_CPUS config option Yury Norov
2022-10-18  8:21   ` Geert Uytterhoeven
2022-10-18 13:15     ` Geert Uytterhoeven
2022-10-18 13:41       ` Andreas Schwab
2022-10-18 13:50         ` Geert Uytterhoeven
2022-10-18 14:35           ` Yury Norov
2022-10-18 14:44             ` Andy Shevchenko
2022-10-18 14:59               ` Yury Norov
2022-10-18 15:15                 ` Geert Uytterhoeven
2022-10-18 16:16                   ` Yury Norov
2022-10-19  6:58                     ` Geert Uytterhoeven
2022-09-06  8:55 ` [PATCH v2 0/5] cpumask: cleanup nr_cpu_ids vs nr_cpumask_bits mess Peter Zijlstra
2022-09-06 12:06   ` Valentin Schneider
2022-09-06 14:38     ` Peter Zijlstra
2022-09-06 15:45       ` Valentin Schneider
2022-09-06 16:26         ` Yury Norov [this message]
2022-09-06 14:48     ` Yury Norov
2022-09-06 14:35   ` Yury Norov
2022-09-15 14:45 ` 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=CAAH8bW-F9e48hbimtgtmv09z7+LiC516KzN55USZZBhq3wv4OQ@mail.gmail.com \
    --to=yury.norov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dvyukov@google.com \
    --cc=ebiggers@google.com \
    --cc=klimov.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sander@svanheule.net \
    --cc=sfr@canb.auug.org.au \
    --cc=tglx@linutronix.de \
    --cc=vbabka@suse.cz \
    --cc=vschneid@redhat.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).