On Tue, Sep 7, 2021 at 5:15 PM Nathan Chancellor nathan@kernel.org wrote:
Ah, okay, that is an x86-only limitation so I missed it. I do not think there is any bug with that Kconfig logic but it is only used on x86.
Yeah. I think other architectures are basically just buggy, but nobody has ever cared or noticed, because the hardware basically doesn't exist.
People hopefully don't actually configure for the kernel theoretical maximum outside of x86. Even there it's a bit ridiculous, but the hardware with lots and lots of cores at least _has_ existed.
Indeed. Grepping around the tree, I see that arc, arm64, ia64, powerpc, and sparc64 all support NR_CPUS up to 4096 (8192 for PPC) but none of them select CPUMASK_OFFSTACK
I think this one says it all:
arch/arc/Kconfig: range 2 4096
yeah. ARC allows you to configure 4k CPU's.
I think a lot of them have just copied the x86 code (it was 4k long ago), without actually understanding all the details.
That is indeed a strong argument for getting rid of the current much-too-subtle CPUMASK_OFFSTACK situation.
But as the hyperv code shows, even on x86 the "we never allocate a full cpumask on the stack" has gotten lost a bit since the days that Rusty and others actually implemented this all.
Linus