diff options
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index d2f4398c5e6f..f28f19e65b59 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -4584,6 +4584,15 @@ recheck: | |||
4584 | return -EPERM; | 4584 | return -EPERM; |
4585 | } | 4585 | } |
4586 | 4586 | ||
4587 | #ifdef CONFIG_RT_GROUP_SCHED | ||
4588 | /* | ||
4589 | * Do not allow realtime tasks into groups that have no runtime | ||
4590 | * assigned. | ||
4591 | */ | ||
4592 | if (rt_policy(policy) && task_group(p)->rt_runtime == 0) | ||
4593 | return -EPERM; | ||
4594 | #endif | ||
4595 | |||
4587 | retval = security_task_setscheduler(p, policy, param); | 4596 | retval = security_task_setscheduler(p, policy, param); |
4588 | if (retval) | 4597 | if (retval) |
4589 | return retval; | 4598 | return retval; |
@@ -8028,9 +8037,15 @@ static int | |||
8028 | cpu_cgroup_can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, | 8037 | cpu_cgroup_can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, |
8029 | struct task_struct *tsk) | 8038 | struct task_struct *tsk) |
8030 | { | 8039 | { |
8040 | #ifdef CONFIG_RT_GROUP_SCHED | ||
8041 | /* Don't accept realtime tasks when there is no way for them to run */ | ||
8042 | if (rt_task(tsk) && cgroup_tg(cgrp)->rt_runtime == 0) | ||
8043 | return -EINVAL; | ||
8044 | #else | ||
8031 | /* We don't support RT-tasks being in separate groups */ | 8045 | /* We don't support RT-tasks being in separate groups */ |
8032 | if (tsk->sched_class != &fair_sched_class) | 8046 | if (tsk->sched_class != &fair_sched_class) |
8033 | return -EINVAL; | 8047 | return -EINVAL; |
8048 | #endif | ||
8034 | 8049 | ||
8035 | return 0; | 8050 | return 0; |
8036 | } | 8051 | } |