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

Configure Feed

Select the types of activity you want to include in your feed.

sched: Restructure sched_class order sanity checks in sched_init()

Currently, sched_init() checks that the sched_class'es are in the expected
order by testing each adjacency which is a bit brittle and makes it
cumbersome to add optional sched_class'es. Instead, let's verify whether
they're in the expected order using sched_class_above() which is what
matters.

Signed-off-by: Tejun Heo <tj@kernel.org>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Reviewed-by: David Vernet <dvernet@meta.com>

+4 -4
+4 -4
kernel/sched/core.c
··· 8164 8164 int i; 8165 8165 8166 8166 /* Make sure the linker didn't screw up */ 8167 - BUG_ON(&idle_sched_class != &fair_sched_class + 1 || 8168 - &fair_sched_class != &rt_sched_class + 1 || 8169 - &rt_sched_class != &dl_sched_class + 1); 8170 8167 #ifdef CONFIG_SMP 8171 - BUG_ON(&dl_sched_class != &stop_sched_class + 1); 8168 + BUG_ON(!sched_class_above(&stop_sched_class, &dl_sched_class)); 8172 8169 #endif 8170 + BUG_ON(!sched_class_above(&dl_sched_class, &rt_sched_class)); 8171 + BUG_ON(!sched_class_above(&rt_sched_class, &fair_sched_class)); 8172 + BUG_ON(!sched_class_above(&fair_sched_class, &idle_sched_class)); 8173 8173 8174 8174 wait_bit_init(); 8175 8175