[PATCH v1 15/19] sched: update h_load to use u64

From: Nikhil Rao
Date: Sun May 01 2011 - 21:20:03 EST


Calculate tg->h_load using u64 to handle u64 load weights.

Signed-off-by: Nikhil Rao <ncrao@xxxxxxxxxx>
---
kernel/sched.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 08dcd24..6b9b02a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -354,7 +354,7 @@ struct cfs_rq {
* Where f(tg) is the recursive weight fraction assigned to
* this group.
*/
- unsigned long h_load;
+ u64 h_load;

/*
* Maintaining per-cpu shares distribution for group scheduling
@@ -1540,15 +1540,17 @@ static unsigned long cpu_avg_load_per_task(int cpu)
*/
static int tg_load_down(struct task_group *tg, void *data)
{
- unsigned long load;
+ u64 load;
long cpu = (long)data;

if (!tg->parent) {
load = cpu_rq(cpu)->load.weight;
} else {
- load = tg->parent->cfs_rq[cpu]->h_load;
- load *= tg->se[cpu]->load.weight;
- load /= tg->parent->cfs_rq[cpu]->load.weight + 1;
+ u64 parent_h_load = tg->parent->cfs_rq[cpu]->h_load;
+ u64 parent_weight = tg->parent->cfs_rq[cpu]->load.weight;
+
+ load = div64_u64(parent_h_load * tg->se[cpu]->load.weight,
+ parent_weight + 1);
}

tg->cfs_rq[cpu]->h_load = load;
--
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/