提交 1c20091e 编写于 作者: F Frederic Weisbecker

nohz: Wake up full dynticks CPUs when a timer gets enqueued

Wake up a CPU when a timer list timer is enqueued there and
the target is part of the full dynticks range. Sending an IPI
to it makes it reconsidering the next timer to program on top
of recent updates.

This may later be improved by checking if the tick is really
stopped on the target. This would need some careful
synchronization though. So deal with such optimization later
and start simple.
Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Geoff Levand <geoff@infradead.org>
Cc: Gilad Ben Yossef <gilad@benyossef.com>
Cc: Hakan Akkan <hakanakkan@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Kevin Hilman <khilman@linaro.org>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
上级 a382bf93
...@@ -1851,9 +1851,9 @@ static inline void idle_task_exit(void) {} ...@@ -1851,9 +1851,9 @@ static inline void idle_task_exit(void) {}
#endif #endif
#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP) #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
extern void wake_up_idle_cpu(int cpu); extern void wake_up_nohz_cpu(int cpu);
#else #else
static inline void wake_up_idle_cpu(int cpu) { } static inline void wake_up_nohz_cpu(int cpu) { }
#endif #endif
#ifdef CONFIG_SCHED_AUTOGROUP #ifdef CONFIG_SCHED_AUTOGROUP
......
...@@ -587,7 +587,7 @@ int get_nohz_timer_target(void) ...@@ -587,7 +587,7 @@ int get_nohz_timer_target(void)
* account when the CPU goes back to idle and evaluates the timer * account when the CPU goes back to idle and evaluates the timer
* wheel for the next timer event. * wheel for the next timer event.
*/ */
void wake_up_idle_cpu(int cpu) static void wake_up_idle_cpu(int cpu)
{ {
struct rq *rq = cpu_rq(cpu); struct rq *rq = cpu_rq(cpu);
...@@ -617,6 +617,24 @@ void wake_up_idle_cpu(int cpu) ...@@ -617,6 +617,24 @@ void wake_up_idle_cpu(int cpu)
smp_send_reschedule(cpu); smp_send_reschedule(cpu);
} }
static bool wake_up_extended_nohz_cpu(int cpu)
{
if (tick_nohz_extended_cpu(cpu)) {
if (cpu != smp_processor_id() ||
tick_nohz_tick_stopped())
smp_send_reschedule(cpu);
return true;
}
return false;
}
void wake_up_nohz_cpu(int cpu)
{
if (!wake_up_extended_nohz_cpu(cpu))
wake_up_idle_cpu(cpu);
}
static inline bool got_nohz_idle_kick(void) static inline bool got_nohz_idle_kick(void)
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
......
...@@ -930,14 +930,14 @@ void add_timer_on(struct timer_list *timer, int cpu) ...@@ -930,14 +930,14 @@ void add_timer_on(struct timer_list *timer, int cpu)
debug_activate(timer, timer->expires); debug_activate(timer, timer->expires);
internal_add_timer(base, timer); internal_add_timer(base, timer);
/* /*
* Check whether the other CPU is idle and needs to be * Check whether the other CPU is in dynticks mode and needs
* triggered to reevaluate the timer wheel when nohz is * to be triggered to reevaluate the timer wheel.
* active. We are protected against the other CPU fiddling * We are protected against the other CPU fiddling
* with the timer by holding the timer base lock. This also * with the timer by holding the timer base lock. This also
* makes sure that a CPU on the way to idle can not evaluate * makes sure that a CPU on the way to stop its tick can not
* the timer wheel. * evaluate the timer wheel.
*/ */
wake_up_idle_cpu(cpu); wake_up_nohz_cpu(cpu);
spin_unlock_irqrestore(&base->lock, flags); spin_unlock_irqrestore(&base->lock, flags);
} }
EXPORT_SYMBOL_GPL(add_timer_on); EXPORT_SYMBOL_GPL(add_timer_on);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册