diff options
| -rw-r--r-- | include/linux/tick.h | 25 | ||||
| -rw-r--r-- | kernel/time/tick-sched.c | 14 |
2 files changed, 25 insertions, 14 deletions
diff --git a/include/linux/tick.h b/include/linux/tick.h index 9180f4b85e6d..c60b079e1b37 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,15 +160,34 @@ 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); | ||
| 163 | extern void tick_nohz_full_check(void); | 183 | 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; } |
| 190 | static inline bool tick_nohz_full_cpu(int cpu) { return false; } | ||
| 170 | static inline void tick_nohz_full_check(void) { } | 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) { } |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index b28dee43e644..0b7887389bd2 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
| @@ -149,7 +149,7 @@ static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs) | |||
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | #ifdef CONFIG_NO_HZ_FULL | 151 | #ifdef CONFIG_NO_HZ_FULL |
| 152 | static cpumask_var_t tick_nohz_full_mask; | 152 | cpumask_var_t tick_nohz_full_mask; |
| 153 | bool tick_nohz_full_running; | 153 | bool tick_nohz_full_running; |
| 154 | 154 | ||
| 155 | static bool can_stop_full_tick(void) | 155 | static bool can_stop_full_tick(void) |
| @@ -270,14 +270,6 @@ out: | |||
| 270 | local_irq_restore(flags); | 270 | local_irq_restore(flags); |
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | int tick_nohz_full_cpu(int cpu) | ||
| 274 | { | ||
| 275 | if (!tick_nohz_full_running) | ||
| 276 | return 0; | ||
| 277 | |||
| 278 | return cpumask_test_cpu(cpu, tick_nohz_full_mask); | ||
| 279 | } | ||
| 280 | |||
| 281 | /* Parse the boot-time nohz CPU list from the kernel parameters. */ | 273 | /* Parse the boot-time nohz CPU list from the kernel parameters. */ |
| 282 | static int __init tick_nohz_full_setup(char *str) | 274 | static int __init tick_nohz_full_setup(char *str) |
| 283 | { | 275 | { |
| @@ -359,8 +351,6 @@ void __init tick_nohz_init(void) | |||
| 359 | cpulist_scnprintf(nohz_full_buf, sizeof(nohz_full_buf), tick_nohz_full_mask); | 351 | cpulist_scnprintf(nohz_full_buf, sizeof(nohz_full_buf), tick_nohz_full_mask); |
| 360 | pr_info("NO_HZ: Full dynticks CPUs: %s.\n", nohz_full_buf); | 352 | pr_info("NO_HZ: Full dynticks CPUs: %s.\n", nohz_full_buf); |
| 361 | } | 353 | } |
| 362 | #else | ||
| 363 | #define tick_nohz_full_running (0) | ||
| 364 | #endif | 354 | #endif |
| 365 | 355 | ||
| 366 | /* | 356 | /* |
| @@ -738,7 +728,7 @@ static bool can_stop_idle_tick(int cpu, struct tick_sched *ts) | |||
| 738 | return false; | 728 | return false; |
| 739 | } | 729 | } |
| 740 | 730 | ||
| 741 | if (tick_nohz_full_running) { | 731 | if (tick_nohz_full_enabled()) { |
| 742 | /* | 732 | /* |
| 743 | * Keep the tick alive to guarantee timekeeping progression | 733 | * Keep the tick alive to guarantee timekeeping progression |
| 744 | * if there are full dynticks CPUs around | 734 | * if there are full dynticks CPUs around |
