[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1355127754-8444-13-git-send-email-alex.shi@intel.com>
Date: Mon, 10 Dec 2012 16:22:28 +0800
From: Alex Shi <alex.shi@...el.com>
To: rob@...dley.net, mingo@...hat.com, peterz@...radead.org
Cc: gregkh@...uxfoundation.org, andre.przywara@....com, rjw@...k.pl,
paul.gortmaker@...driver.com, akpm@...ux-foundation.org,
paulmck@...ux.vnet.ibm.com, linux-kernel@...r.kernel.org,
pjt@...gle.com, vincent.guittot@...aro.org
Subject: [PATCH 12/18] sched: log the cpu utilization at rq
The cpu's utilization is to measure how busy is the cpu.
util = cpu_rq(cpu)->avg.runnable_avg_sum
/ cpu_rq(cpu)->avg.runnable_avg_period;
Since the util is no more than 1, we use its percentage value in later
caculations.
Considering there are interval between balancing, if the cpu util is
up to 97%, we can think it is full of load in a health kernel.
In later power aware scheduling, we are sensitive for how busy of the
cpu, not how weight of its load. As to power comsuming, it is more
related with busy time, not the load weight.
Signed-off-by: Alex Shi <alex.shi@...el.com>
---
kernel/sched/fair.c | 4 ++++
kernel/sched/sched.h | 3 +++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1b1deb8..4cc1764 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1269,8 +1269,12 @@ static void update_cfs_rq_blocked_load(struct cfs_rq *cfs_rq, int force_update)
static inline void update_rq_runnable_avg(struct rq *rq, int runnable)
{
+ int period;
__update_entity_runnable_avg(rq->clock_task, &rq->avg, runnable);
__update_tg_runnable_avg(&rq->avg, &rq->cfs);
+
+ period = rq->avg.runnable_avg_period ? rq->avg.runnable_avg_period : 1;
+ rq->util = rq->avg.runnable_avg_sum * 100 / period;
}
/* Add the load generated by se into cfs_rq's child load-average */
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 7a5eae4..5247560 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -350,6 +350,8 @@ extern struct root_domain def_root_domain;
#endif /* CONFIG_SMP */
+/* Take as full load, if the cpu util is up to 97% */
+#define FULL_UTIL 97
/*
* This is the main, per-CPU runqueue data structure.
*
@@ -481,6 +483,7 @@ struct rq {
#endif
struct sched_avg avg;
+ unsigned int util;
};
static inline int cpu_of(struct rq *rq)
--
1.7.5.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists