diff options
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 8e63ffb6ed0..dfae1bf6d5b 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -223,7 +223,7 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b) | |||
223 | { | 223 | { |
224 | ktime_t now; | 224 | ktime_t now; |
225 | 225 | ||
226 | if (rt_bandwidth_enabled() && rt_b->rt_runtime == RUNTIME_INF) | 226 | if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF) |
227 | return; | 227 | return; |
228 | 228 | ||
229 | if (hrtimer_active(&rt_b->rt_period_timer)) | 229 | if (hrtimer_active(&rt_b->rt_period_timer)) |
@@ -9319,6 +9319,16 @@ static int sched_rt_global_constraints(void) | |||
9319 | 9319 | ||
9320 | return ret; | 9320 | return ret; |
9321 | } | 9321 | } |
9322 | |||
9323 | int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk) | ||
9324 | { | ||
9325 | /* Don't accept realtime tasks when there is no way for them to run */ | ||
9326 | if (rt_task(tsk) && tg->rt_bandwidth.rt_runtime == 0) | ||
9327 | return 0; | ||
9328 | |||
9329 | return 1; | ||
9330 | } | ||
9331 | |||
9322 | #else /* !CONFIG_RT_GROUP_SCHED */ | 9332 | #else /* !CONFIG_RT_GROUP_SCHED */ |
9323 | static int sched_rt_global_constraints(void) | 9333 | static int sched_rt_global_constraints(void) |
9324 | { | 9334 | { |
@@ -9412,8 +9422,7 @@ cpu_cgroup_can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, | |||
9412 | struct task_struct *tsk) | 9422 | struct task_struct *tsk) |
9413 | { | 9423 | { |
9414 | #ifdef CONFIG_RT_GROUP_SCHED | 9424 | #ifdef CONFIG_RT_GROUP_SCHED |
9415 | /* Don't accept realtime tasks when there is no way for them to run */ | 9425 | if (!sched_rt_can_attach(cgroup_tg(cgrp), tsk)) |
9416 | if (rt_task(tsk) && cgroup_tg(cgrp)->rt_bandwidth.rt_runtime == 0) | ||
9417 | return -EINVAL; | 9426 | return -EINVAL; |
9418 | #else | 9427 | #else |
9419 | /* We don't support RT-tasks being in separate groups */ | 9428 | /* We don't support RT-tasks being in separate groups */ |