From a8db0bb752df20ffb153a442d228e09cab65968e Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 3 Jul 2009 08:30:06 -0500 Subject: [PATCH] sched: Prevent boosting of idle task on -rt commit 4ee888c3c41c562c6d575011cc4696bcddc2f956 in tip. Idle task boosting is a nono in general. There is one exception, when 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 Signed-off-by: Ingo Molnar Signed-off-by: Paul Gortmaker --- kernel/sched.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index d56e54d..29d4416 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -4474,6 +4474,25 @@ void task_setprio(struct task_struct *p, int prio) BUG_ON(prio < 0 || prio > MAX_PRIO); rq = task_rq_lock(p, &flags); + + /* + * Idle task boosting is a nono in general. There is one + * exception, when 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. + */ + if (unlikely(p == rq->idle)) { + WARN_ON(p != rq->curr); + WARN_ON(p->pi_blocked_on); + goto out_unlock; + } + update_rq_clock(rq); oldprio = p->prio; @@ -4502,6 +4521,7 @@ void task_setprio(struct task_struct *p, int prio) check_class_changed(rq, p, prev_class, oldprio, running); } +out_unlock: task_rq_unlock(rq, &flags); } -- 1.7.0.4