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 8626ae50ce08..0d8905a1b8ca 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7746,24 +7746,27 @@ static int dattrs_equal(struct sched_domain_attr *cur, int idx_cur,
7746 * and partition_sched_domains() will fallback to the single partition 7746 * and partition_sched_domains() will fallback to the single partition
7747 * 'fallback_doms', it also forces the domains to be rebuilt. 7747 * 'fallback_doms', it also forces the domains to be rebuilt.
7748 * 7748 *
7749 * If doms_new==NULL it will be replaced with cpu_online_map.
7750 * ndoms_new==0 is a special case for destroying existing domains.
7751 * It will not create the default domain.
7752 *
7749 * Call with hotplug lock held 7753 * Call with hotplug lock held
7750 */ 7754 */
7751void partition_sched_domains(int ndoms_new, cpumask_t *doms_new, 7755void partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
7752 struct sched_domain_attr *dattr_new) 7756 struct sched_domain_attr *dattr_new)
7753{ 7757{
7754 int i, j; 7758 int i, j, n;
7755 7759
7756 mutex_lock(&sched_domains_mutex); 7760 mutex_lock(&sched_domains_mutex);
7757 7761
7758 /* always unregister in case we don't destroy any domains */ 7762 /* always unregister in case we don't destroy any domains */
7759 unregister_sched_domain_sysctl(); 7763 unregister_sched_domain_sysctl();
7760 7764
7761 if (doms_new == NULL) 7765 n = doms_new ? ndoms_new : 0;
7762 ndoms_new = 0;
7763 7766
7764 /* Destroy deleted domains */ 7767 /* Destroy deleted domains */
7765 for (i = 0; i < ndoms_cur; i++) { 7768 for (i = 0; i < ndoms_cur; i++) {
7766 for (j = 0; j < ndoms_new; j++) { 7769 for (j = 0; j < n; j++) {
7767 if (cpus_equal(doms_cur[i], doms_new[j]) 7770 if (cpus_equal(doms_cur[i], doms_new[j])
7768 && dattrs_equal(dattr_cur, i, dattr_new, j)) 7771 && dattrs_equal(dattr_cur, i, dattr_new, j))
7769 goto match1; 7772 goto match1;
@@ -7776,7 +7779,6 @@ match1:
7776 7779
7777 if (doms_new == NULL) { 7780 if (doms_new == NULL) {
7778 ndoms_cur = 0; 7781 ndoms_cur = 0;
7779 ndoms_new = 1;
7780 doms_new = &fallback_doms; 7782 doms_new = &fallback_doms;
7781 cpus_andnot(doms_new[0], cpu_online_map, cpu_isolated_map); 7783 cpus_andnot(doms_new[0], cpu_online_map, cpu_isolated_map);
7782 dattr_new = NULL; 7784 dattr_new = NULL;
@@ -7813,8 +7815,13 @@ match2:
7813int arch_reinit_sched_domains(void) 7815int arch_reinit_sched_domains(void)
7814{ 7816{
7815 get_online_cpus(); 7817 get_online_cpus();
7818
7819 /* Destroy domains first to force the rebuild */
7820 partition_sched_domains(0, NULL, NULL);
7821
7816 rebuild_sched_domains(); 7822 rebuild_sched_domains();
7817 put_online_cpus(); 7823 put_online_cpus();
7824
7818 return 0; 7825 return 0;
7819} 7826}
7820 7827
@@ -7898,7 +7905,7 @@ static int update_sched_domains(struct notifier_block *nfb,
7898 case CPU_ONLINE_FROZEN: 7905 case CPU_ONLINE_FROZEN:
7899 case CPU_DEAD: 7906 case CPU_DEAD:
7900 case CPU_DEAD_FROZEN: 7907 case CPU_DEAD_FROZEN:
7901 partition_sched_domains(0, NULL, NULL); 7908 partition_sched_domains(1, NULL, NULL);
7902 return NOTIFY_OK; 7909 return NOTIFY_OK;
7903 7910
7904 default: 7911 default: