From 07a3f329340975a3f3e830d343f7a2c6e83a441f Mon Sep 17 00:00:00 2001 From: Lianwei Wang Date: Fri, 26 Apr 2013 10:59:24 +0800 Subject: [PATCH] cpuidle: wakeup processor on a smaller latency Checking the PM-Qos latency and cpu idle sleep latency, and only wakeup the cpu if the requested PM-Qos latency is smaller than its idle sleep latency. Change-Id: If564fd0d9c53cf100bd85247bfd509dfeaf54c13 Signed-off-by: Lianwei Wang --- drivers/cpuidle/cpuidle.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 2f0083a..cd1af4b 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "cpuidle.h" @@ -466,7 +467,20 @@ static void smp_callback(void *v) static int cpuidle_latency_notify(struct notifier_block *b, unsigned long l, void *v) { - smp_call_function(smp_callback, NULL, 1); + int cpu, rcpu = smp_processor_id(); + s64 s; + struct tick_device *td; + + for_each_online_cpu(cpu) { + if (cpu == rcpu) + continue; + td = tick_get_device(cpu); + s = ktime_us_delta(td->evtdev->next_event, ktime_get()); + if ((long)l < (long)s) { + smp_call_function_single(cpu, smp_callback, NULL, 1); + } + } + return NOTIFY_OK; } -- 1.7.4.1