Re: [PATCH 11/11] nodemask: add cpumask-style operation size bounds
From: Gregory Price (Meta)
Date: Thu Dec 03 2026 - 22:36:56 EST
On 2026-12-01 19:01 -0500, Yury Norov wrote:
> > This breaks cpuset.mems :
> >
> > 2 node host - {0,1}
> >
> > echo 0-3:1/4 > cpuset.mems
> > before: succeeds - result: {0}
> > now: ERANGE
>
> Here user explicitly refers non-existing nodes 2 and 3. So, as for the
> patch #3, it's unclear, do we erroneously accept the invalid input?
>
You assume they're non-existing. They're not presently hotplugged.
cpuset.mems can contain valid but empty nodes, and this is allowed.
> Any example with explicit boundaries is vulnerable. The above 0-3:1/4
> would work fine for 2-node machine with MAX_NUMNODES == 1024. But if I
> will recompile my kernel with MAX_NUMNODES == 2, it will return ERANGE.
> It already happens on master, and nobody complains.
>
> > echo 0-1:1/_ > cpuset.mems
> > before: succeeds - result: {0}
> > now: {0,1}
>
> Did you mean 0-1:1/N?
>
> I'm one of those who invented that N notation, and I'm pretty
> confident that "2 nodes and 0-1:1/N" simply means all node".
>
Before the patch, cpuset.mems parsed range endpoints against
MAX_NUMNODES, then checked which nodes the pattern actually selected.
After the patch, it rejects anything in [nr_node_ids, MAX_NUMNODES)
before applying the pattern.
For example MAX_NUMNODES=1024 and nr_node_ids=2, 0-3:1/4 used to succeed
and selected only {0}. Now it fails with ERANGE because the endpoint on
the range is 3.
Maybe we want that, maybe we don't. We should be open about the change.
Another scan, this can also affect the tmpfs mpol= mount option.
At the very least, please note this in the changelog and make it
obvious. I will likely test this all a bit further.
> I asked AI to find an example of using N in the group part of nodelist
> description, and it found nothing deployed. I asked to check all distros
> and major apps that would immediately observe this switch to runtime
> nr_node_ids, and it found nothing again.
>
"clanker says this breaks nothing in distro code" is not good evidence
because we don't know else is using these interfaces.
It's good data, but not itself an argument to go forcefully changing the
ABI without discussion.
I'm otherwise ok with the overall direction of this, I just don't want
to overlook these rough edges.
--
~Gregory