aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Guittot <vincent.guittot@linaro.org>2013-07-25 13:56:08 +0200
committerVincent Guittot <vincent.guittot@linaro.org>2013-10-17 22:11:03 +0200
commit9d1393ef1cbf7d3274e206eee8210aba0cc2667e (patch)
tree4b4be182f603512e1bb7f061c4a3522f0f0b3d43
parent6cd288fa2f4ca4887705fbf48718f12d09a4ac5d (diff)
cpuidle: set the current wake up latencyHEADmaster
Save the current wake up latency of a core. This latency is not always the latency of a defined c-state but can also be an intermediate value when a core is ready to shutdown (timer migration, cache flush ...) but wait for the last core of the cluster to finalize the cluster power down. This latter use case is not manage by the current version of the patch because it implies that the cpuidle drivers set the wake up latency instead of the cpuidle core. Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> Conflicts: drivers/cpuidle/cpuidle.c
-rw-r--r--drivers/cpuidle/cpuidle.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index d75040ddd2b3..7b6553b049cd 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -19,6 +19,7 @@
#include <linux/ktime.h>
#include <linux/hrtimer.h>
#include <linux/module.h>
+#include <linux/sched.h>
#include <trace/events/power.h>
#include "cpuidle.h"
@@ -42,6 +43,12 @@ void disable_cpuidle(void)
off = 1;
}
+static void cpuidle_set_current_state(int cpu, int latency)
+{
+ struct sched_pm *stat = &per_cpu(sched_stat, cpu);
+
+ atomic_set(&(stat->wake_latency), latency);
+}
/**
* cpuidle_play_dead - cpu off-lining
*
@@ -79,12 +86,16 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
ktime_t time_start, time_end;
s64 diff;
+ cpuidle_set_current_state(dev->cpu, target_state->exit_latency);
+
time_start = ktime_get();
entered_state = target_state->enter(dev, drv, index);
time_end = ktime_get();
+ cpuidle_set_current_state(dev->cpu, 0);
+
local_irq_enable();
diff = ktime_to_us(ktime_sub(time_end, time_start));