Commit c3272d7c authored by William Lee Irwin III's avatar William Lee Irwin III Committed by Linus Torvalds

[PATCH] fix sched_domains hotplug bootstrap ordering vs. cpu_online_map issue

cpu_online_map is not set up at the time of sched domain initialization
when hotplug cpu paths are used for SMP booting.

At this phase of bootstrapping, cpu_possible_map can be used by the
various architectures using cpu hotplugging for SMP bootstrap, but the
manipulations of cpu_online_map done on behalf of NUMA architectures,
done indirectly via node_to_cpumask(), can't, because cpu_online_map
starts depopulated and hasn't yet been populated.

On true NUMA architectures this is a distinct cpumask_t from
cpu_online_map and so the unpatched code works on NUMA; on non-NUMA
architectures the definition of node_to_cpumask() this way breaks and
would require an invasive sweeping of users of node_to_cpumask() to
change it to e.g.  cpu_possible_map, as cpu_possible_map is not suitable
for use at runtime as a substitute for cpu_online_map.
Signed-off-by: default avatarWilliam Irwin <wli@holomorphy.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent eaa8fe26
...@@ -4468,7 +4468,11 @@ __init static void arch_init_sched_domains(void) ...@@ -4468,7 +4468,11 @@ __init static void arch_init_sched_domains(void)
sd = &per_cpu(phys_domains, i); sd = &per_cpu(phys_domains, i);
group = cpu_to_phys_group(i); group = cpu_to_phys_group(i);
*sd = SD_CPU_INIT; *sd = SD_CPU_INIT;
#ifdef CONFIG_NUMA
sd->span = nodemask; sd->span = nodemask;
#else
sd->span = cpu_possible_map;
#endif
sd->parent = p; sd->parent = p;
sd->groups = &sched_group_phys[group]; sd->groups = &sched_group_phys[group];
...@@ -4506,6 +4510,7 @@ __init static void arch_init_sched_domains(void) ...@@ -4506,6 +4510,7 @@ __init static void arch_init_sched_domains(void)
&cpu_to_isolated_group); &cpu_to_isolated_group);
} }
#ifdef CONFIG_NUMA
/* Set up physical groups */ /* Set up physical groups */
for (i = 0; i < MAX_NUMNODES; i++) { for (i = 0; i < MAX_NUMNODES; i++) {
cpumask_t nodemask = node_to_cpumask(i); cpumask_t nodemask = node_to_cpumask(i);
...@@ -4517,6 +4522,10 @@ __init static void arch_init_sched_domains(void) ...@@ -4517,6 +4522,10 @@ __init static void arch_init_sched_domains(void)
init_sched_build_groups(sched_group_phys, nodemask, init_sched_build_groups(sched_group_phys, nodemask,
&cpu_to_phys_group); &cpu_to_phys_group);
} }
#else
init_sched_build_groups(sched_group_phys, cpu_possible_map,
&cpu_to_phys_group);
#endif
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
/* Set up node groups */ /* Set up node groups */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment