aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-06-06 14:07:38 -0400
committerIngo Molnar <mingo@elte.hu>2012-03-01 04:28:05 -0500
commit1c4dd99bed5f6f70932bf8dacdd54d04a2619778 (patch)
tree24b6db83e0507598e255de9e5b410a8300ab7572 /kernel/sched
parent63b2001169e75cd71e917ec953fdab572e3f944a (diff)
sched/rt: Prevent idle task boosting
Idle task boosting is a nono in general. There is one exception, when PREEMPT_RT and NOHZ is active: The idle task calls get_next_timer_interrupt() and holds the timer wheel base->lock on the CPU and another CPU wants to access the timer (probably to cancel it). We can safely ignore the boosting request, as the idle CPU runs this code with interrupts disabled and will complete the lock protected section without being interrupted. So there is no real need to boost. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/n/tip-755rvsosz7sdzot12a3gbha6@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/core.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 820f7453fda9..c2bbdecaa27d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3779,6 +3779,24 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
3779 3779
3780 rq = __task_rq_lock(p); 3780 rq = __task_rq_lock(p);
3781 3781
3782 /*
3783 * Idle task boosting is a nono in general. There is one
3784 * exception, when PREEMPT_RT and NOHZ is active:
3785 *
3786 * The idle task calls get_next_timer_interrupt() and holds
3787 * the timer wheel base->lock on the CPU and another CPU wants
3788 * to access the timer (probably to cancel it). We can safely
3789 * ignore the boosting request, as the idle CPU runs this code
3790 * with interrupts disabled and will complete the lock
3791 * protected section without being interrupted. So there is no
3792 * real need to boost.
3793 */
3794 if (unlikely(p == rq->idle)) {
3795 WARN_ON(p != rq->curr);
3796 WARN_ON(p->pi_blocked_on);
3797 goto out_unlock;
3798 }
3799
3782 trace_sched_pi_setprio(p, prio); 3800 trace_sched_pi_setprio(p, prio);
3783 oldprio = p->prio; 3801 oldprio = p->prio;
3784 prev_class = p->sched_class; 3802 prev_class = p->sched_class;
@@ -3802,11 +3820,10 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
3802 enqueue_task(rq, p, oldprio < prio ? ENQUEUE_HEAD : 0); 3820 enqueue_task(rq, p, oldprio < prio ? ENQUEUE_HEAD : 0);
3803 3821
3804 check_class_changed(rq, p, prev_class, oldprio); 3822 check_class_changed(rq, p, prev_class, oldprio);
3823out_unlock:
3805 __task_rq_unlock(rq); 3824 __task_rq_unlock(rq);
3806} 3825}
3807
3808#endif 3826#endif
3809
3810void set_user_nice(struct task_struct *p, long nice) 3827void set_user_nice(struct task_struct *p, long nice)
3811{ 3828{
3812 int old_prio, delta, on_rq; 3829 int old_prio, delta, on_rq;