aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index f0ed81b7128..1ddb0a8c797 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7293,6 +7293,18 @@ void __attribute__((weak)) arch_update_cpu_topology(void)
7293} 7293}
7294 7294
7295/* 7295/*
7296 * Free current domain masks.
7297 * Called after all cpus are attached to NULL domain.
7298 */
7299static void free_sched_domains(void)
7300{
7301 ndoms_cur = 0;
7302 if (doms_cur != &fallback_doms)
7303 kfree(doms_cur);
7304 doms_cur = &fallback_doms;
7305}
7306
7307/*
7296 * Set up scheduler domains and groups. Callers must hold the hotplug lock. 7308 * Set up scheduler domains and groups. Callers must hold the hotplug lock.
7297 * For now this just excludes isolated cpus, but could be used to 7309 * For now this just excludes isolated cpus, but could be used to
7298 * exclude other special cases in the future. 7310 * exclude other special cases in the future.
@@ -7439,6 +7451,7 @@ int arch_reinit_sched_domains(void)
7439 get_online_cpus(); 7451 get_online_cpus();
7440 mutex_lock(&sched_domains_mutex); 7452 mutex_lock(&sched_domains_mutex);
7441 detach_destroy_domains(&cpu_online_map); 7453 detach_destroy_domains(&cpu_online_map);
7454 free_sched_domains();
7442 err = arch_init_sched_domains(&cpu_online_map); 7455 err = arch_init_sched_domains(&cpu_online_map);
7443 mutex_unlock(&sched_domains_mutex); 7456 mutex_unlock(&sched_domains_mutex);
7444 put_online_cpus(); 7457 put_online_cpus();
@@ -7524,6 +7537,7 @@ static int update_sched_domains(struct notifier_block *nfb,
7524 case CPU_DOWN_PREPARE: 7537 case CPU_DOWN_PREPARE:
7525 case CPU_DOWN_PREPARE_FROZEN: 7538 case CPU_DOWN_PREPARE_FROZEN:
7526 detach_destroy_domains(&cpu_online_map); 7539 detach_destroy_domains(&cpu_online_map);
7540 free_sched_domains();
7527 return NOTIFY_OK; 7541 return NOTIFY_OK;
7528 7542
7529 case CPU_UP_CANCELED: 7543 case CPU_UP_CANCELED:
@@ -7542,8 +7556,16 @@ static int update_sched_domains(struct notifier_block *nfb,
7542 return NOTIFY_DONE; 7556 return NOTIFY_DONE;
7543 } 7557 }
7544 7558
7559#ifndef CONFIG_CPUSETS
7560 /*
7561 * Create default domain partitioning if cpusets are disabled.
7562 * Otherwise we let cpusets rebuild the domains based on the
7563 * current setup.
7564 */
7565
7545 /* The hotplug lock is already held by cpu_up/cpu_down */ 7566 /* The hotplug lock is already held by cpu_up/cpu_down */
7546 arch_init_sched_domains(&cpu_online_map); 7567 arch_init_sched_domains(&cpu_online_map);
7568#endif
7547 7569
7548 return NOTIFY_OK; 7570 return NOTIFY_OK;
7549} 7571}