summaryrefslogtreecommitdiffstats
path: root/kernel/sched/debug.c
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2019-01-29 10:12:45 -0500
committerIngo Molnar <mingo@kernel.org>2019-02-04 03:13:21 -0500
commit1ca4fa3ab604734e38e2a3000c9abf788512ffa7 (patch)
tree15cde208d2056c6f20ef2f54f04d6aec471522af /kernel/sched/debug.c
parent10a35e6812aa0953f02a956c499d23fe4e68af4a (diff)
sched/debug: Initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK
register_sched_domain_sysctl() copies the cpu_possible_mask into sd_sysctl_cpus, but only if sd_sysctl_cpus hasn't already been allocated (ie, CONFIG_CPUMASK_OFFSTACK is set). However, when CONFIG_CPUMASK_OFFSTACK is not set, sd_sysctl_cpus is left uninitialized (all zeroes) and the kernel may fail to initialize sched_domain sysctl entries for all possible CPUs. This is visible to the user if the kernel is booted with maxcpus=n, or if ACPI tables have been modified to leave CPUs offline, and then checking for missing /proc/sys/kernel/sched_domain/cpu* entries. Fix this by separating the allocation and initialization, and adding a flag to initialize the possible CPU entries while system booting only. Tested-by: Syuuichirou Ishii <ishii.shuuichir@jp.fujitsu.com> Tested-by: Tarumizu, Kohei <tarumizu.kohei@jp.fujitsu.com> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Masayoshi Mizuma <msys.mizuma@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20190129151245.5073-1-msys.mizuma@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/debug.c')
-rw-r--r--kernel/sched/debug.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index de3de997e245..8039d62ae36e 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -315,6 +315,7 @@ void register_sched_domain_sysctl(void)
315{ 315{
316 static struct ctl_table *cpu_entries; 316 static struct ctl_table *cpu_entries;
317 static struct ctl_table **cpu_idx; 317 static struct ctl_table **cpu_idx;
318 static bool init_done = false;
318 char buf[32]; 319 char buf[32];
319 int i; 320 int i;
320 321
@@ -344,7 +345,10 @@ void register_sched_domain_sysctl(void)
344 if (!cpumask_available(sd_sysctl_cpus)) { 345 if (!cpumask_available(sd_sysctl_cpus)) {
345 if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL)) 346 if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL))
346 return; 347 return;
348 }
347 349
350 if (!init_done) {
351 init_done = true;
348 /* init to possible to not have holes in @cpu_entries */ 352 /* init to possible to not have holes in @cpu_entries */
349 cpumask_copy(sd_sysctl_cpus, cpu_possible_mask); 353 cpumask_copy(sd_sysctl_cpus, cpu_possible_mask);
350 } 354 }