diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-03-22 09:20:24 +0100 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-03-26 08:28:55 +0100 |
commit | 06d8308c61e54346585b2691c13ee3f90cb6fb2f (patch) | |
tree | d522e285525964706e7ec112bca23d407a540a8e /kernel/timer.c | |
parent | 898a19de1502649877091b398229026b4142c0e2 (diff) | |
download | linux-stable-06d8308c61e54346585b2691c13ee3f90cb6fb2f.tar.gz linux-stable-06d8308c61e54346585b2691c13ee3f90cb6fb2f.tar.bz2 linux-stable-06d8308c61e54346585b2691c13ee3f90cb6fb2f.zip |
NOHZ: reevaluate idle sleep length after add_timer_on()
add_timer_on() can add a timer on a CPU which is currently in a long
idle sleep, but the timer wheel is not reevaluated by the nohz code on
that CPU. So a timer can be delayed for quite a long time. This
triggered a false positive in the clocksource watchdog code.
To avoid this we need to wake up the idle CPU and enforce the
reevaluation of the timer wheel for the next timer event.
Add a function, which checks a given CPU for idle state, marks the
idle task with NEED_RESCHED and sends a reschedule IPI to notify the
other CPU of the change in the timer wheel.
Call this function from add_timer_on().
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: stable@kernel.org
--
include/linux/sched.h | 6 ++++++
kernel/sched.c | 43 +++++++++++++++++++++++++++++++++++++++++++
kernel/timer.c | 10 +++++++++-
3 files changed, 58 insertions(+), 1 deletion(-)
Diffstat (limited to 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index 99b00a25f88b..b024106daa70 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -451,10 +451,18 @@ void add_timer_on(struct timer_list *timer, int cpu) spin_lock_irqsave(&base->lock, flags); timer_set_base(timer, base); internal_add_timer(base, timer); + /* + * Check whether the other CPU is idle and needs to be + * triggered to reevaluate the timer wheel when nohz is + * active. We are protected against the other CPU fiddling + * with the timer by holding the timer base lock. This also + * makes sure that a CPU on the way to idle can not evaluate + * the timer wheel. + */ + wake_up_idle_cpu(cpu); spin_unlock_irqrestore(&base->lock, flags); } - /** * mod_timer - modify a timer's timeout * @timer: the timer to be modified |