diff options
Diffstat (limited to 'include/linux/tick.h')
-rw-r--r-- | include/linux/tick.h | 45 |
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 |
163 | extern bool tick_nohz_full_running; | ||
164 | extern cpumask_var_t tick_nohz_full_mask; | ||
165 | |||
166 | static 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 | |||
174 | static 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 | |||
161 | extern void tick_nohz_init(void); | 182 | extern void tick_nohz_init(void); |
162 | extern int tick_nohz_full_cpu(int cpu); | 183 | extern void __tick_nohz_full_check(void); |
163 | extern void tick_nohz_full_check(void); | ||
164 | extern void tick_nohz_full_kick(void); | 184 | extern void tick_nohz_full_kick(void); |
165 | extern void tick_nohz_full_kick_all(void); | 185 | extern void tick_nohz_full_kick_all(void); |
166 | extern void tick_nohz_task_switch(struct task_struct *tsk); | 186 | extern void __tick_nohz_task_switch(struct task_struct *tsk); |
167 | #else | 187 | #else |
168 | static inline void tick_nohz_init(void) { } | 188 | static inline void tick_nohz_init(void) { } |
169 | static inline int tick_nohz_full_cpu(int cpu) { return 0; } | 189 | static inline bool tick_nohz_full_enabled(void) { return false; } |
170 | static inline void tick_nohz_full_check(void) { } | 190 | static inline bool tick_nohz_full_cpu(int cpu) { return false; } |
191 | static inline void __tick_nohz_full_check(void) { } | ||
171 | static inline void tick_nohz_full_kick(void) { } | 192 | static inline void tick_nohz_full_kick(void) { } |
172 | static inline void tick_nohz_full_kick_all(void) { } | 193 | static inline void tick_nohz_full_kick_all(void) { } |
173 | static inline void tick_nohz_task_switch(struct task_struct *tsk) { } | 194 | static inline void __tick_nohz_task_switch(struct task_struct *tsk) { } |
174 | #endif | 195 | #endif |
175 | 196 | ||
197 | static inline void tick_nohz_full_check(void) | ||
198 | { | ||
199 | if (tick_nohz_full_enabled()) | ||
200 | __tick_nohz_full_check(); | ||
201 | } | ||
202 | |||
203 | static 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 |