Re: [PATCH 00/11] nodemask: switch to runtime nr_node_ids

From: Andrew Morton

Date: Sat Nov 28 2026 - 18:40:52 EST


On Fri, 27 Nov 2026 18:01:17 -0500 Yury Norov <ynorov@xxxxxxxxxx> wrote:

> Nodemasks have a compile-time capacity of MAX_NUMNODES, and
> nr_node_ids describes the runtime node ID usage.
>
> Modern distros, like my Ubuntu, default MAX_NUMNODES to 1024, while the
> actual number of nodes is typically smaller. All nodemask functions
> currently refer to the MAX_NUMNODES, which adds a substantial overhead
> on every traversing operation.
>

Thanks Yury, this is a worthy effort!


First thought: mainline Linux defaults x86_64 MAX_NUMNODES to 64. But
99.9% of our users say "well that's crap, let's use X instead".

The below is unreliable and very approximate, but my LLM's scouring
turned up the following guesstimates:

Who MAX_NUMNODES
RHEL 1024
SUSE 1024
Oracle 1024
Ubuntu 1024
Debian 1024
Fedora 1024
AWS ~1024
Google ~64
Microsoft ~1024
Meta ~64-1024
Tencent ~1024

I suggest that we change mainline's default so what-we're-testing
better represents what-they're-using. This somewhat offtopic, but
wdyt? Would such a change affect this patchset?

> This series switches the kernel to runtime length of nodemasks, which
> also saves up to 8K of .text for minimal config, and accelerates basic
> nodemask operations ~4x if MAX_NUMNODES == 1024 and nr_node_ids == 2.

I'm saddened by how many instances of MAX_NUMNODES remain in the tree!
I'd love to see that become zero. But that would involve using
alloca() or its equivalents. I think alloc() is neat but I've always
lost that fight (LT), never really understood why.

Series looks nice, applies cleanly for me. Sashiko said a thing
(https://sashiko.dev/#/patchset/20261127230128.111933-1-ynorov@xxxxxxxxxx).
I'll continue to monitor, see what reviewers have to say (please).