partition_sched_domains: Do not destroy old sched domain on cpu_up
This is safe on a cpu_up only. Although a reader may still have
access to the old scheduling domain data, the data indicates that
the new CPU is not up, and therefore the only limitation is the
new CPU will not be schedulable by that reader until that reader
receives the new data.
Signed-off-by: Maya Spivak <mspivak@codeaurora.org>
diff --git a/kernel/sched.c b/kernel/sched.c
index f5bc88c..8388f03 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7666,6 +7666,7 @@
{
int i, j, n;
int new_topology;
+ cpumask_var_t doms_temp;
mutex_lock(&sched_domains_mutex);
@@ -7675,14 +7676,20 @@
/* Let architecture update cpu core mappings. */
new_topology = arch_update_cpu_topology();
+ cpumask_andnot(doms_temp, cpu_active_mask, cpu_isolated_map);
+
n = doms_new ? ndoms_new : 0;
/* Destroy deleted domains */
for (i = 0; i < ndoms_cur; i++) {
- for (j = 0; j < n && !new_topology; j++) {
- if (cpumask_equal(doms_cur[i], doms_new[j])
- && dattrs_equal(dattr_cur, i, dattr_new, j))
+ if (!new_topology) {
+ if ((n == 0) && cpumask_subset(doms_cur[i], doms_temp))
goto match1;
+ for (j = 0; j < n; j++) {
+ if (cpumask_equal(doms_cur[i], doms_new[j])
+ && dattrs_equal(dattr_cur, i, dattr_new, j))
+ goto match1;
+ }
}
/* no match - a current sched domain not in new doms_new[] */
detach_destroy_domains(doms_cur[i]);