aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 1a5f73c1fcdc..cc1f81b50b82 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7696,24 +7696,27 @@ static int dattrs_equal(struct sched_domain_attr *cur, int idx_cur,
7696 * and partition_sched_domains() will fallback to the single partition 7696 * and partition_sched_domains() will fallback to the single partition
7697 * 'fallback_doms', it also forces the domains to be rebuilt. 7697 * 'fallback_doms', it also forces the domains to be rebuilt.
7698 * 7698 *
7699 * If doms_new==NULL it will be replaced with cpu_online_map.
7700 * ndoms_new==0 is a special case for destroying existing domains.
7701 * It will not create the default domain.
7702 *
7699 * Call with hotplug lock held 7703 * Call with hotplug lock held
7700 */ 7704 */
7701void partition_sched_domains(int ndoms_new, cpumask_t *doms_new, 7705void partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
7702 struct sched_domain_attr *dattr_new) 7706 struct sched_domain_attr *dattr_new)
7703{ 7707{
7704 int i, j; 7708 int i, j, n;
7705 7709
7706 mutex_lock(&sched_domains_mutex); 7710 mutex_lock(&sched_domains_mutex);
7707 7711
7708 /* always unregister in case we don't destroy any domains */ 7712 /* always unregister in case we don't destroy any domains */
7709 unregister_sched_domain_sysctl(); 7713 unregister_sched_domain_sysctl();
7710 7714
7711 if (doms_new == NULL) 7715 n = doms_new ? ndoms_new : 0;
7712 ndoms_new = 0;
7713 7716
7714 /* Destroy deleted domains */ 7717 /* Destroy deleted domains */
7715 for (i = 0; i < ndoms_cur; i++) { 7718 for (i = 0; i < ndoms_cur; i++) {
7716 for (j = 0; j < ndoms_new; j++) { 7719 for (j = 0; j < n; j++) {
7717 if (cpus_equal(doms_cur[i], doms_new[j]) 7720 if (cpus_equal(doms_cur[i], doms_new[j])
7718 && dattrs_equal(dattr_cur, i, dattr_new, j)) 7721 && dattrs_equal(dattr_cur, i, dattr_new, j))
7719 goto match1; 7722 goto match1;
@@ -7726,7 +7729,6 @@ match1:
7726 7729
7727 if (doms_new == NULL) { 7730 if (doms_new == NULL) {
7728 ndoms_cur = 0; 7731 ndoms_cur = 0;
7729 ndoms_new = 1;
7730 doms_new = &fallback_doms; 7732 doms_new = &fallback_doms;
7731 cpus_andnot(doms_new[0], cpu_online_map, cpu_isolated_map); 7733 cpus_andnot(doms_new[0], cpu_online_map, cpu_isolated_map);
7732 dattr_new = NULL; 7734 dattr_new = NULL;
@@ -7763,8 +7765,13 @@ match2:
7763int arch_reinit_sched_domains(void) 7765int arch_reinit_sched_domains(void)
7764{ 7766{
7765 get_online_cpus(); 7767 get_online_cpus();
7768
7769 /* Destroy domains first to force the rebuild */
7770 partition_sched_domains(0, NULL, NULL);
7771
7766 rebuild_sched_domains(); 7772 rebuild_sched_domains();
7767 put_online_cpus(); 7773 put_online_cpus();
7774
7768 return 0; 7775 return 0;
7769} 7776}
7770 7777
@@ -7848,7 +7855,7 @@ static int update_sched_domains(struct notifier_block *nfb,
7848 case CPU_ONLINE_FROZEN: 7855 case CPU_ONLINE_FROZEN:
7849 case CPU_DEAD: 7856 case CPU_DEAD:
7850 case CPU_DEAD_FROZEN: 7857 case CPU_DEAD_FROZEN:
7851 partition_sched_domains(0, NULL, NULL); 7858 partition_sched_domains(1, NULL, NULL);
7852 return NOTIFY_OK; 7859 return NOTIFY_OK;
7853 7860
7854 default: 7861 default: