]> Gentwo Git Trees - linux/.git/commit
cpumask: Cache num_possible_cpus()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 19 Nov 2025 17:27:01 +0000 (18:27 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 25 Nov 2025 18:45:40 +0000 (19:45 +0100)
commit35a5c37cb9f1f947dff18e7cfc75a8cfcfd557ca
tree433d9305c706e6a9f64ba61ca6e57cdba42a433f
parent79c11fb3da8581a2f222b290ce62a153ab1108fc
cpumask: Cache num_possible_cpus()

Reevaluating num_possible_cpus() over and over does not make sense. That
becomes a constant after init as cpu_possible_mask is marked ro_after_init.

Cache the value during initialization and provide that for consumption.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Yury Norov <yury.norov@gmail.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Link: https://patch.msgid.link/20251119172549.578653738@linutronix.de
include/linux/cpumask.h
kernel/cpu.c