diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-03 14:33:20 -0800 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-03 14:33:20 -0800 | 
| commit | 219f170a85fee524fa528ef75a0432b79af95d0b (patch) | |
| tree | 13489998c59c5d7ac6d46b7835c7f4a6ccfab2e6 /kernel/sched.c | |
| parent | 3024e4a99744f5b59704a6570524a312f94f010f (diff) | |
| parent | 54e991242850edc8c53f71fa5aa3ba7a93ce38f5 (diff) | |
Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  sched: don't allow setuid to succeed if the user does not have rt bandwidth
  sched_rt: don't start timer when rt bandwidth disabled
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 410eec404133..8e2558c2ba67 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 */  | 
