aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Weisbecker <frederic@kernel.org>2018-02-20 23:17:25 -0500
committerIngo Molnar <mingo@kernel.org>2018-02-21 03:49:08 -0500
commit22ab8bc02a5f6e8ffc418759894f7a6b0b632331 (patch)
treed911f27f0661ad8390190da9910d8751287e55f8
parenta364298359e74a414857bbbf3b725564feb22d09 (diff)
nohz: Allow to check if remote CPU tick is stopped
This check is racy but provides a good heuristic to determine whether a CPU may need a remote tick or not. Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Chris Metcalf <cmetcalf@mellanox.com> Cc: Christoph Lameter <cl@linux.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Luiz Capitulino <lcapitulino@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Rik van Riel <riel@redhat.com> Cc: Wanpeng Li <kernellwp@gmail.com> Link: http://lkml.kernel.org/r/1519186649-3242-4-git-send-email-frederic@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--include/linux/tick.h2
-rw-r--r--kernel/time/tick-sched.c7
2 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 86576d9d2311..7f8c9a127f5a 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -114,6 +114,7 @@ enum tick_dep_bits {
114#ifdef CONFIG_NO_HZ_COMMON 114#ifdef CONFIG_NO_HZ_COMMON
115extern bool tick_nohz_enabled; 115extern bool tick_nohz_enabled;
116extern bool tick_nohz_tick_stopped(void); 116extern bool tick_nohz_tick_stopped(void);
117extern bool tick_nohz_tick_stopped_cpu(int cpu);
117extern void tick_nohz_idle_enter(void); 118extern void tick_nohz_idle_enter(void);
118extern void tick_nohz_idle_exit(void); 119extern void tick_nohz_idle_exit(void);
119extern void tick_nohz_irq_exit(void); 120extern void tick_nohz_irq_exit(void);
@@ -125,6 +126,7 @@ extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
125#else /* !CONFIG_NO_HZ_COMMON */ 126#else /* !CONFIG_NO_HZ_COMMON */
126#define tick_nohz_enabled (0) 127#define tick_nohz_enabled (0)
127static inline int tick_nohz_tick_stopped(void) { return 0; } 128static inline int tick_nohz_tick_stopped(void) { return 0; }
129static inline int tick_nohz_tick_stopped_cpu(int cpu) { return 0; }
128static inline void tick_nohz_idle_enter(void) { } 130static inline void tick_nohz_idle_enter(void) { }
129static inline void tick_nohz_idle_exit(void) { } 131static inline void tick_nohz_idle_exit(void) { }
130 132
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 0aba0412ede5..d479b21a848b 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -486,6 +486,13 @@ bool tick_nohz_tick_stopped(void)
486 return __this_cpu_read(tick_cpu_sched.tick_stopped); 486 return __this_cpu_read(tick_cpu_sched.tick_stopped);
487} 487}
488 488
489bool tick_nohz_tick_stopped_cpu(int cpu)
490{
491 struct tick_sched *ts = per_cpu_ptr(&tick_cpu_sched, cpu);
492
493 return ts->tick_stopped;
494}
495
489/** 496/**
490 * tick_nohz_update_jiffies - update jiffies when idle was interrupted 497 * tick_nohz_update_jiffies - update jiffies when idle was interrupted
491 * 498 *