aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index eaf6751e7612..4a3cb0614158 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1127,6 +1127,7 @@ static enum hrtimer_restart hrtick(struct hrtimer *timer)
1127 return HRTIMER_NORESTART; 1127 return HRTIMER_NORESTART;
1128} 1128}
1129 1129
1130#ifdef CONFIG_SMP
1130static void hotplug_hrtick_disable(int cpu) 1131static void hotplug_hrtick_disable(int cpu)
1131{ 1132{
1132 struct rq *rq = cpu_rq(cpu); 1133 struct rq *rq = cpu_rq(cpu);
@@ -1182,6 +1183,7 @@ static void init_hrtick(void)
1182{ 1183{
1183 hotcpu_notifier(hotplug_hrtick, 0); 1184 hotcpu_notifier(hotplug_hrtick, 0);
1184} 1185}
1186#endif /* CONFIG_SMP */
1185 1187
1186static void init_rq_hrtick(struct rq *rq) 1188static void init_rq_hrtick(struct rq *rq)
1187{ 1189{
@@ -7236,6 +7238,18 @@ void __attribute__((weak)) arch_update_cpu_topology(void)
7236} 7238}
7237 7239
7238/* 7240/*
7241 * Free current domain masks.
7242 * Called after all cpus are attached to NULL domain.
7243 */
7244static void free_sched_domains(void)
7245{
7246 ndoms_cur = 0;
7247 if (doms_cur != &fallback_doms)
7248 kfree(doms_cur);
7249 doms_cur = &fallback_doms;
7250}
7251
7252/*
7239 * Set up scheduler domains and groups. Callers must hold the hotplug lock. 7253 * Set up scheduler domains and groups. Callers must hold the hotplug lock.
7240 * For now this just excludes isolated cpus, but could be used to 7254 * For now this just excludes isolated cpus, but could be used to
7241 * exclude other special cases in the future. 7255 * exclude other special cases in the future.
@@ -7382,6 +7396,7 @@ int arch_reinit_sched_domains(void)
7382 get_online_cpus(); 7396 get_online_cpus();
7383 mutex_lock(&sched_domains_mutex); 7397 mutex_lock(&sched_domains_mutex);
7384 detach_destroy_domains(&cpu_online_map); 7398 detach_destroy_domains(&cpu_online_map);
7399 free_sched_domains();
7385 err = arch_init_sched_domains(&cpu_online_map); 7400 err = arch_init_sched_domains(&cpu_online_map);
7386 mutex_unlock(&sched_domains_mutex); 7401 mutex_unlock(&sched_domains_mutex);
7387 put_online_cpus(); 7402 put_online_cpus();
@@ -7467,6 +7482,7 @@ static int update_sched_domains(struct notifier_block *nfb,
7467 case CPU_DOWN_PREPARE: 7482 case CPU_DOWN_PREPARE:
7468 case CPU_DOWN_PREPARE_FROZEN: 7483 case CPU_DOWN_PREPARE_FROZEN:
7469 detach_destroy_domains(&cpu_online_map); 7484 detach_destroy_domains(&cpu_online_map);
7485 free_sched_domains();
7470 return NOTIFY_OK; 7486 return NOTIFY_OK;
7471 7487
7472 case CPU_UP_CANCELED: 7488 case CPU_UP_CANCELED:
@@ -7485,8 +7501,16 @@ static int update_sched_domains(struct notifier_block *nfb,
7485 return NOTIFY_DONE; 7501 return NOTIFY_DONE;
7486 } 7502 }
7487 7503
7504#ifndef CONFIG_CPUSETS
7505 /*
7506 * Create default domain partitioning if cpusets are disabled.
7507 * Otherwise we let cpusets rebuild the domains based on the
7508 * current setup.
7509 */
7510
7488 /* The hotplug lock is already held by cpu_up/cpu_down */ 7511 /* The hotplug lock is already held by cpu_up/cpu_down */
7489 arch_init_sched_domains(&cpu_online_map); 7512 arch_init_sched_domains(&cpu_online_map);
7513#endif
7490 7514
7491 return NOTIFY_OK; 7515 return NOTIFY_OK;
7492} 7516}
@@ -7626,7 +7650,6 @@ static void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq,
7626 else 7650 else
7627 rt_se->rt_rq = parent->my_q; 7651 rt_se->rt_rq = parent->my_q;
7628 7652
7629 rt_se->rt_rq = &rq->rt;
7630 rt_se->my_q = rt_rq; 7653 rt_se->my_q = rt_rq;
7631 rt_se->parent = parent; 7654 rt_se->parent = parent;
7632 INIT_LIST_HEAD(&rt_se->run_list); 7655 INIT_LIST_HEAD(&rt_se->run_list);
@@ -8348,7 +8371,7 @@ static unsigned long to_ratio(u64 period, u64 runtime)
8348#ifdef CONFIG_CGROUP_SCHED 8371#ifdef CONFIG_CGROUP_SCHED
8349static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime) 8372static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime)
8350{ 8373{
8351 struct task_group *tgi, *parent = tg->parent; 8374 struct task_group *tgi, *parent = tg ? tg->parent : NULL;
8352 unsigned long total = 0; 8375 unsigned long total = 0;
8353 8376
8354 if (!parent) { 8377 if (!parent) {