Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sched/smp: Always define sched_domains_mutex_lock()/unlock(), def_root_domain and sched_domains_mutex

Simplify the scheduler by making CONFIG_SMP=y primitives and data
structures unconditional.

Unconditionally build kernel/sched/topology.c and the main sched-domains
locking primitives.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Valentin Schneider <vschneid@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20250528080924.2273858-20-mingo@kernel.org

+6 -6
-5
include/linux/sched.h
··· 395 395 UCLAMP_CNT 396 396 }; 397 397 398 - #ifdef CONFIG_SMP 399 398 extern struct root_domain def_root_domain; 400 399 extern struct mutex sched_domains_mutex; 401 400 extern void sched_domains_mutex_lock(void); 402 401 extern void sched_domains_mutex_unlock(void); 403 - #else 404 - static inline void sched_domains_mutex_lock(void) { } 405 - static inline void sched_domains_mutex_unlock(void) { } 406 - #endif 407 402 408 403 struct sched_param { 409 404 int sched_priority;
+2 -1
kernel/sched/build_utility.c
··· 83 83 #ifdef CONFIG_SMP 84 84 # include "cpupri.c" 85 85 # include "stop_task.c" 86 - # include "topology.c" 87 86 #endif 87 + 88 + #include "topology.c" 88 89 89 90 #ifdef CONFIG_SCHED_CORE 90 91 # include "core_sched.c"
+4
kernel/sched/topology.c
··· 17 17 mutex_unlock(&sched_domains_mutex); 18 18 } 19 19 20 + #ifdef CONFIG_SMP 21 + 20 22 /* Protected by sched_domains_mutex: */ 21 23 static cpumask_var_t sched_domains_tmpmask; 22 24 static cpumask_var_t sched_domains_tmpmask2; ··· 2844 2842 partition_sched_domains_locked(ndoms_new, doms_new, dattr_new); 2845 2843 sched_domains_mutex_unlock(); 2846 2844 } 2845 + 2846 + #endif /* CONFIG_SMP */