cpu: Initialize __num_possible_cpus correctly
The variable to cache the number of possible CPUs is initialized to NR_CPUS
at build time, but that's only correct when cpu_possible_mask is
initialized with CPU_BITS_ALL. That's only the case on PARISC.
On x86 and quite some architectures this does not matter because they
initialize cpu_possible_mask via init_cpu_possible() which does a proper
weight calculation. Though on architectures which do not, this results in a
completely wrong cached value: NR_CPUS + actual possible CPUs as enumerated.
Initialize it correctly to 0 when CONFIG_INIT_ALL_POSSIBLE=n and move the
NR_CPUS initialization into the PARISC specific section.
Fixes: d0f23ccf6ba9 ("cpumask: Cache num_possible_cpus()")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Closes: https://lore.kernel.org/all/89c7106e-a431-443a-9527-3d5fbce77fe1@samsung.com
Closes: https://lore.kernel.org/all/20251122002755.GA2682494@ax162
1 file changed