From: Yury Norov <yury.norov@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: Re: [GIT PULL] bitmap changes for v6.0-rc1
Date: Mon, 10 Oct 2022 20:07:44 -0700 [thread overview]
Message-ID: <Y0TeAGLngwVbgtuK@yury-laptop> (raw)
In-Reply-To: <CAHk-=whf2zgBzGMse-y-yD_oTfofRHQQV-gy3O-iQBE7oOiSGA@mail.gmail.com>
On Mon, Oct 10, 2022 at 02:18:46PM -0700, Linus Torvalds wrote:
> On Mon, Oct 10, 2022 at 2:12 PM Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> > On Sun, Oct 2, 2022 at 7:03 PM Yury Norov <yury.norov@gmail.com> wrote:
> > >
> > > lib/cpumask: add FORCE_NR_CPUS config option
> >
> > Side note: I think we should make this option depend on EXPERT.
OK. I'll send a patch.
> Oh, and if a constant 'nr_cpu_ids' is such an important thing from a
> code generation standpoint, maybe we'd be better off saying 'for small
> NR_CPUS, just make nr_cpu_ids be that small constant".
From what I see, 'FORCE' effects on size 3x more for bigger NR_CPU_IDS.
For x86_64 allmodconfig build (w/o MAXSMP) on top of today's master:
NR_CPUS Diff Absolute values
FORCE=n FORCE=y
8192 -222429 373299266 373076837
256 -221799 363679392 363457593
4 -88922 363387049 363298127
> Rather than confusing people with a question that is a bit strange.
> Afaik, all our kernel code has to work with "nr_cpu_id's doesn't match
> the number of CPU's we actually have", because of cpu hotplug (and
> suspend/resume) issues anyway.
nr_cpu_ids is a number of possible cpus. Once set, it's never changed.
What system has now is online cpus. FORCE_NR_CPU_IDS doesn't break
hotplug because it only controls when we set nr_cpu_ids - at boot time
or compile time.
> So I _think_ all the nr_cpu_id's games are mainly because we don't
> want to allocate huge arrays when you can't actually have that many
> CPU's - but for a small NR_CPUS situation that just isn't an issue
> anyway.
>
> Yes? No?
You're talking about .data section. FORCE_NR_CPUS is about .text and
code generation.
Compile-time allocations for cpumasks, per-cpu variables etc. shouldn't
change when we build kernel with FORCE_NR_CPUS on and off against the
same NR_CPUS, right?
I originally expected that 'FORCE' will improve code generation for
NR_CPUS < BITS_PER_LONG because it allows small_const_nbits()
optimization in cpumasks. But with big NR_CPUS it works even better.
I don't know exactly why. nr_cpu_ids is used widely beyond cpumasks,
after all.
Thanks,
Yury
next prev parent reply other threads:[~2022-10-11 3:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 2:03 Yury Norov
2022-10-04 17:55 ` Linus Torvalds
2022-10-04 18:16 ` Yury Norov
2022-10-10 20:05 ` pr-tracker-bot
2022-10-10 21:12 ` Linus Torvalds
2022-10-10 21:18 ` Linus Torvalds
2022-10-11 3:07 ` Yury Norov [this message]
2022-10-11 3:19 ` Linus Torvalds
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=Y0TeAGLngwVbgtuK@yury-laptop \
--to=yury.norov@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=torvalds@linux-foundation.org \
/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
all inboxes | Powered by JetHome®