aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2014-06-04 10:17:33 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2014-06-16 10:26:54 -0400
commit3d36aebc2e78923095575df954f3f3b430ac0a30 (patch)
tree59a76641c6c2c34447b2fbfa61d4e029950ba5dc
parent478850160636c4f0b2558451df0e42f8c5a10939 (diff)
nohz: Support nohz full remote kick
Remotely kicking a full nohz CPU in order to make it re-evaluate its next tick is currently implemented using the scheduler IPI. However this bloats a scheduler fast path with an off-topic feature. The scheduler tick was abused here for its cool "callable anywhere/anytime" properties. But now that the irq work subsystem can queue remote callbacks, it's a perfect fit to safely queue IPIs when interrupts are disabled without worrying about concurrent callers. So lets implement remote kick on top of irq work. This is going to be used when a new event requires the next tick to be recalculated: more than 1 task competing on the CPU, timer armed, ... Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Kevin Hilman <khilman@linaro.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
-rw-r--r--include/linux/tick.h9
-rw-r--r--kernel/time/tick-sched.c10
2 files changed, 14 insertions, 5 deletions
diff --git a/include/linux/tick.h b/include/linux/tick.h
index b84773cb9f4c..8a4987f2294a 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -181,7 +181,13 @@ static inline bool tick_nohz_full_cpu(int cpu)
181 181
182extern void tick_nohz_init(void); 182extern void tick_nohz_init(void);
183extern void __tick_nohz_full_check(void); 183extern void __tick_nohz_full_check(void);
184extern void tick_nohz_full_kick(void); 184extern void tick_nohz_full_kick_cpu(int cpu);
185
186static inline void tick_nohz_full_kick(void)
187{
188 tick_nohz_full_kick_cpu(smp_processor_id());
189}
190
185extern void tick_nohz_full_kick_all(void); 191extern void tick_nohz_full_kick_all(void);
186extern void __tick_nohz_task_switch(struct task_struct *tsk); 192extern void __tick_nohz_task_switch(struct task_struct *tsk);
187#else 193#else
@@ -189,6 +195,7 @@ static inline void tick_nohz_init(void) { }
189static inline bool tick_nohz_full_enabled(void) { return false; } 195static inline bool tick_nohz_full_enabled(void) { return false; }
190static inline bool tick_nohz_full_cpu(int cpu) { return false; } 196static inline bool tick_nohz_full_cpu(int cpu) { return false; }
191static inline void __tick_nohz_full_check(void) { } 197static inline void __tick_nohz_full_check(void) { }
198static inline void tick_nohz_full_kick_cpu(int cpu) { }
192static inline void tick_nohz_full_kick(void) { } 199static inline void tick_nohz_full_kick(void) { }
193static inline void tick_nohz_full_kick_all(void) { } 200static inline void tick_nohz_full_kick_all(void) { }
194static inline void __tick_nohz_task_switch(struct task_struct *tsk) { } 201static inline void __tick_nohz_task_switch(struct task_struct *tsk) { }
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 6558b7ac112d..3d63944a3eca 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -224,13 +224,15 @@ static DEFINE_PER_CPU(struct irq_work, nohz_full_kick_work) = {
224}; 224};
225 225
226/* 226/*
227 * Kick the current CPU if it's full dynticks in order to force it to 227 * Kick the CPU if it's full dynticks in order to force it to
228 * re-evaluate its dependency on the tick and restart it if necessary. 228 * re-evaluate its dependency on the tick and restart it if necessary.
229 */ 229 */
230void tick_nohz_full_kick(void) 230void tick_nohz_full_kick_cpu(int cpu)
231{ 231{
232 if (tick_nohz_full_cpu(smp_processor_id())) 232 if (!tick_nohz_full_cpu(cpu))
233 irq_work_queue(&__get_cpu_var(nohz_full_kick_work)); 233 return;
234
235 irq_work_queue_on(&per_cpu(nohz_full_kick_work, cpu), cpu);
234} 236}
235 237
236static void nohz_full_kick_ipi(void *info) 238static void nohz_full_kick_ipi(void *info)