aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Guittot <vincent.guittot@linaro.org>2013-07-23 11:07:07 +0200
committerVincent Guittot <vincent.guittot@linaro.org>2013-10-17 22:11:02 +0200
commitaff0c477fde9e6a3db6a3fdeb861b165e9595929 (patch)
tree8abfd32a212a6d08c10fb884ae94e86ec4473e38
parent6df5c916b4ebae9116e7960aa35cebbced6ee57d (diff)
sched: create a statistic structure
Create a statistic structure that will be used to share information with other frameworks like cpuidle and cpufreq. This structure only contains the current wake up latency of a core for now but could be extended with other usefull information. Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
-rw-r--r--include/linux/sched.h12
-rw-r--r--kernel/sched/fair.c5
2 files changed, 16 insertions, 1 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2004cdb33d61..d676aa297a9b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2,7 +2,7 @@
#define _LINUX_SCHED_H
#include <uapi/linux/sched.h>
-
+#include <linux/atomic.h>
struct sched_param {
int sched_priority;
@@ -63,6 +63,16 @@ struct fs_struct;
struct perf_event_context;
struct blk_plug;
+/* This structure is used to share information and statistics with other
+ * frameworks. It only shares wake up latency fro the moment but should be
+ * extended with other usefull informations
+ */
+struct sched_pm {
+ atomic_t wake_latency; /* time to wake up the cpu */
+};
+
+DECLARE_PER_CPU(struct sched_pm, sched_stat);
+
/*
* List of flags we want to share for kernel threads,
* if only because they are not used by them anyway.
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 2d9f782a3498..ad8b99ae24b7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -178,6 +178,11 @@ void sched_init_granularity(void)
update_sysctl();
}
+/* Save per_cpu information that will be shared with other frameworks */
+DEFINE_PER_CPU(struct sched_pm, sched_stat) = {
+ .wake_latency = ATOMIC_INIT(0)
+};
+
#ifdef CONFIG_SMP
static unsigned long available_of(int cpu)
{