From 930e2352bf4234da5ba885c48d2bc13b2f4ff079 Mon Sep 17 00:00:00 2001 From: Mahesh Sivasubramanian Date: Thu, 26 Jan 2017 16:37:08 -0700 Subject: [PATCH] kernel: tick-sched: Add API to get the next wakeup for a CPU Add get_next_event_cpu to get the next wakeup time for the CPU. This is used by the sleep driver if it has to query the next wakeup for a CPU other than the thread that its running on. Change-Id: I889de90928b9b1e51a51b2f9205d7865facfcc20 Signed-off-by: Mahesh Sivasubramanian --- include/linux/tick.h | 1 + kernel/time/tick-sched.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/linux/tick.h b/include/linux/tick.h index 7511544fe4f1..513cd4fda2ba 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -304,4 +304,5 @@ static inline void tick_nohz_task_switch(void) __tick_nohz_task_switch(); } +ktime_t *get_next_event_cpu(unsigned int cpu); #endif diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 189e77b4bb25..5f98592501de 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1342,3 +1342,8 @@ int tick_check_oneshot_change(int allow_nohz) tick_nohz_switch_to_nohz(); return 0; } + +ktime_t *get_next_event_cpu(unsigned int cpu) +{ + return &(per_cpu(tick_cpu_device, cpu).evtdev->next_event); +}