Thread (21 messages) 21 messages, 4 authors, 2016-07-27

[PATCH 08/14] timer: Export next wake up of a CPU

From: Thomas Gleixner <hidden>
Date: 2016-07-27 09:14:30
Also in: linux-arm-msm, linux-pm

On Wed, 22 Jun 2016, Lina Iyer wrote:
+static inline ktime_t tick_nohz_get_next_wakeup(int cpu)
+{
+	ktime_t len = { .tv64 = NSEC_PER_SEC/HZ };
+
+	/* Next wake up is the tick period, assume it starts now */
+	return ktime_add(len, ktime_get());
  return tick_next_period;

Will tell you the point where the next tick interrupt is due.
quoted hunk ↗ jump to hunk
+}
+
 static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
 static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
 #endif /* !CONFIG_NO_HZ_COMMON */
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 536ada8..addf3235 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -979,6 +979,19 @@ ktime_t tick_nohz_get_sleep_length(void)
 	return ts->sleep_length;
 }
 
+/**
+ * tick_nohz_get_next_wakeup - return the next wake up of the CPU
+ *
+ * Called with interrupts disabled on the cpu
So why are you handing in the (undocumented) cpu argument if its called on
that cpu anyway?
+ */
+ktime_t tick_nohz_get_next_wakeup(int cpu)
+{
+	struct clock_event_device *dev =
+			per_cpu(tick_cpu_device.evtdev, cpu);
+
+	return dev->next_event;
Then this becomes

     return __this_cpu_read(tick_cpu_device.evtdev)->nextevt;

Thanks,

	tglx
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help