aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2013-07-24 17:52:27 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2013-08-14 11:14:58 -0400
commitd13508f9440e46dccac6a2dd48d51a73b2207482 (patch)
tree880feb6b503b5c450ba27b589aae7461626ffc74
parent460775df4680b4593d8449bc171008578625a850 (diff)
nohz: Optimize full dynticks's sched hooks with static keys
Scheduler IPIs and task context switches are serious fast path. Let's try to hide as much as we can the impact of full dynticks APIs' off case that are called on these sites through the use of static keys. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Li Zhong <zhong@linux.vnet.ibm.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Kevin Hilman <khilman@linaro.org>
-rw-r--r--include/linux/tick.h20
-rw-r--r--kernel/time/tick-sched.c8
2 files changed, 20 insertions, 8 deletions
diff --git a/include/linux/tick.h b/include/linux/tick.h
index c60b079e1b37..a7ef1d6fceb6 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -180,20 +180,32 @@ static inline bool tick_nohz_full_cpu(int cpu)
180} 180}
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(void);
185extern void tick_nohz_full_kick_all(void); 185extern void tick_nohz_full_kick_all(void);
186extern void tick_nohz_task_switch(struct task_struct *tsk); 186extern void __tick_nohz_task_switch(struct task_struct *tsk);
187#else 187#else
188static inline void tick_nohz_init(void) { } 188static inline void tick_nohz_init(void) { }
189static inline bool tick_nohz_full_enabled(void) { return false; } 189static inline bool tick_nohz_full_enabled(void) { return false; }
190static inline bool tick_nohz_full_cpu(int cpu) { return false; } 190static inline bool tick_nohz_full_cpu(int cpu) { return false; }
191static inline void tick_nohz_full_check(void) { } 191static inline void __tick_nohz_full_check(void) { }
192static inline void tick_nohz_full_kick(void) { } 192static inline void tick_nohz_full_kick(void) { }
193static inline void tick_nohz_full_kick_all(void) { } 193static inline void tick_nohz_full_kick_all(void) { }
194static inline void tick_nohz_task_switch(struct task_struct *tsk) { } 194static inline void __tick_nohz_task_switch(struct task_struct *tsk) { }
195#endif 195#endif
196 196
197static inline void tick_nohz_full_check(void)
198{
199 if (tick_nohz_full_enabled())
200 __tick_nohz_full_check();
201}
202
203static inline void tick_nohz_task_switch(struct task_struct *tsk)
204{
205 if (tick_nohz_full_enabled())
206 __tick_nohz_task_switch(tsk);
207}
208
197 209
198# ifdef CONFIG_CPU_IDLE_GOV_MENU 210# ifdef CONFIG_CPU_IDLE_GOV_MENU
199extern void menu_hrtimer_cancel(void); 211extern void menu_hrtimer_cancel(void);
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 0b7887389bd2..0ff6ae710161 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -198,7 +198,7 @@ static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now);
198 * Re-evaluate the need for the tick on the current CPU 198 * Re-evaluate the need for the tick on the current CPU
199 * and restart it if necessary. 199 * and restart it if necessary.
200 */ 200 */
201void tick_nohz_full_check(void) 201void __tick_nohz_full_check(void)
202{ 202{
203 struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); 203 struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched);
204 204
@@ -212,7 +212,7 @@ void tick_nohz_full_check(void)
212 212
213static void nohz_full_kick_work_func(struct irq_work *work) 213static void nohz_full_kick_work_func(struct irq_work *work)
214{ 214{
215 tick_nohz_full_check(); 215 __tick_nohz_full_check();
216} 216}
217 217
218static DEFINE_PER_CPU(struct irq_work, nohz_full_kick_work) = { 218static DEFINE_PER_CPU(struct irq_work, nohz_full_kick_work) = {
@@ -231,7 +231,7 @@ void tick_nohz_full_kick(void)
231 231
232static void nohz_full_kick_ipi(void *info) 232static void nohz_full_kick_ipi(void *info)
233{ 233{
234 tick_nohz_full_check(); 234 __tick_nohz_full_check();
235} 235}
236 236
237/* 237/*
@@ -254,7 +254,7 @@ void tick_nohz_full_kick_all(void)
254 * It might need the tick due to per task/process properties: 254 * It might need the tick due to per task/process properties:
255 * perf events, posix cpu timers, ... 255 * perf events, posix cpu timers, ...
256 */ 256 */
257void tick_nohz_task_switch(struct task_struct *tsk) 257void __tick_nohz_task_switch(struct task_struct *tsk)
258{ 258{
259 unsigned long flags; 259 unsigned long flags;
260 260