[PATCH v1 08/19] sched: update find_idlest_group() to use u64

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


Update find_idlest_group() to use u64 to accumulate and maintain cpu_load
weights.

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

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index c08324b..49e1eeb 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1527,11 +1527,11 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,
int this_cpu, int load_idx)
{
struct sched_group *idlest = NULL, *group = sd->groups;
- unsigned long min_load = ULONG_MAX, this_load = 0;
+ u64 min_load = ULLONG_MAX, this_load = 0;
int imbalance = 100 + (sd->imbalance_pct-100)/2;

do {
- unsigned long load, avg_load;
+ u64 load, avg_load;
int local_group;
int i;

@@ -1557,7 +1557,8 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,
}

/* Adjust by relative CPU power of the group */
- avg_load = (avg_load * SCHED_POWER_SCALE) / group->cpu_power;
+ avg_load *= SCHED_POWER_SCALE;
+ avg_load = div_u64(avg_load, group->cpu_power);

if (local_group) {
this_load = avg_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/