aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tick.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/tick.h')
-rw-r--r--include/linux/tick.h45
1 files changed, 39 insertions, 6 deletions
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 62bd8b72873c..5128d33bbb39 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -10,6 +10,8 @@
10#include <linux/irqflags.h> 10#include <linux/irqflags.h>
11#include <linux/percpu.h> 11#include <linux/percpu.h>
12#include <linux/hrtimer.h> 12#include <linux/hrtimer.h>
13#include <linux/context_tracking_state.h>
14#include <linux/cpumask.h>
13 15
14#ifdef CONFIG_GENERIC_CLOCKEVENTS 16#ifdef CONFIG_GENERIC_CLOCKEVENTS
15 17
@@ -158,20 +160,51 @@ static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
158# endif /* !CONFIG_NO_HZ_COMMON */ 160# endif /* !CONFIG_NO_HZ_COMMON */
159 161
160#ifdef CONFIG_NO_HZ_FULL 162#ifdef CONFIG_NO_HZ_FULL
163extern bool tick_nohz_full_running;
164extern cpumask_var_t tick_nohz_full_mask;
165
166static inline bool tick_nohz_full_enabled(void)
167{
168 if (!static_key_false(&context_tracking_enabled))
169 return false;
170
171 return tick_nohz_full_running;
172}
173
174static inline bool tick_nohz_full_cpu(int cpu)
175{
176 if (!tick_nohz_full_enabled())
177 return false;
178
179 return cpumask_test_cpu(cpu, tick_nohz_full_mask);
180}
181
161extern void tick_nohz_init(void); 182extern void tick_nohz_init(void);
162extern int tick_nohz_full_cpu(int cpu); 183extern void __tick_nohz_full_check(void);
163extern void tick_nohz_full_check(void);
164extern void tick_nohz_full_kick(void); 184extern void tick_nohz_full_kick(void);
165extern void tick_nohz_full_kick_all(void); 185extern void tick_nohz_full_kick_all(void);
166extern void tick_nohz_task_switch(struct task_struct *tsk); 186extern void __tick_nohz_task_switch(struct task_struct *tsk);
167#else 187#else
168static inline void tick_nohz_init(void) { } 188static inline void tick_nohz_init(void) { }
169static inline int tick_nohz_full_cpu(int cpu) { return 0; } 189static inline bool tick_nohz_full_enabled(void) { return false; }
170static inline void tick_nohz_full_check(void) { } 190static inline bool tick_nohz_full_cpu(int cpu) { return false; }
191static inline void __tick_nohz_full_check(void) { }
171static inline void tick_nohz_full_kick(void) { } 192static inline void tick_nohz_full_kick(void) { }
172static inline void tick_nohz_full_kick_all(void) { } 193static inline void tick_nohz_full_kick_all(void) { }
173static inline void tick_nohz_task_switch(struct task_struct *tsk) { } 194static inline void __tick_nohz_task_switch(struct task_struct *tsk) { }
174#endif 195#endif
175 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
176 209
177#endif 210#endif