aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-03-13 02:14:25 +0100
committerIngo Molnar <mingo@elte.hu>2009-03-13 02:14:25 +0100
commit25d500067d5a666d1336598d1b324793554e5496 (patch)
tree3402308c4c69a66d02ce55f5c165e242fad2a8a9 /kernel/sched.c
parentgeneric-ipi: cleanups (diff)
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes (diff)
downloadlinux-dev-25d500067d5a666d1336598d1b324793554e5496.tar.xz
linux-dev-25d500067d5a666d1336598d1b324793554e5496.zip
Merge branch 'linus' into core/ipi
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index d4c2749a2998..f1cd71918240 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -223,7 +223,7 @@ static void start_rt_bandwidth(struct rt_bandwidth *rt_b)
{
ktime_t now;
- if (rt_bandwidth_enabled() && rt_b->rt_runtime == RUNTIME_INF)
+ if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF)
return;
if (hrtimer_active(&rt_b->rt_period_timer))
@@ -9224,6 +9224,16 @@ static int sched_rt_global_constraints(void)
return ret;
}
+
+int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
+{
+ /* Don't accept realtime tasks when there is no way for them to run */
+ if (rt_task(tsk) && tg->rt_bandwidth.rt_runtime == 0)
+ return 0;
+
+ return 1;
+}
+
#else /* !CONFIG_RT_GROUP_SCHED */
static int sched_rt_global_constraints(void)
{
@@ -9317,8 +9327,7 @@ cpu_cgroup_can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
struct task_struct *tsk)
{
#ifdef CONFIG_RT_GROUP_SCHED
- /* Don't accept realtime tasks when there is no way for them to run */
- if (rt_task(tsk) && cgroup_tg(cgrp)->rt_bandwidth.rt_runtime == 0)
+ if (!sched_rt_can_attach(cgroup_tg(cgrp), tsk))
return -EINVAL;
#else
/* We don't support RT-tasks being in separate groups */