From: Con Kolivas When the type of weighting is known to be zero we can use a simpler version of source_load with a weighted_cpuload() function. Export that function to allow relative weighted cpu load to be used by other subsystems if desired. Signed-off-by: Con Kolivas Acked-by: Ingo Molnar Signed-off-by: Andrew Morton --- include/linux/sched.h | 1 + kernel/sched.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff -puN include/linux/sched.h~sched-add-discrete-weighted-cpu-load-function include/linux/sched.h --- devel/include/linux/sched.h~sched-add-discrete-weighted-cpu-load-function 2006-05-27 23:29:25.000000000 -0700 +++ devel-akpm/include/linux/sched.h 2006-05-27 23:29:25.000000000 -0700 @@ -123,6 +123,7 @@ extern unsigned long nr_running(void); extern unsigned long nr_uninterruptible(void); extern unsigned long nr_active(void); extern unsigned long nr_iowait(void); +extern unsigned long weighted_cpuload(const int cpu); /* diff -puN kernel/sched.c~sched-add-discrete-weighted-cpu-load-function kernel/sched.c --- devel/kernel/sched.c~sched-add-discrete-weighted-cpu-load-function 2006-05-27 23:29:25.000000000 -0700 +++ devel-akpm/kernel/sched.c 2006-05-27 23:29:25.000000000 -0700 @@ -950,6 +950,12 @@ inline int task_curr(const task_t *p) return cpu_curr(task_cpu(p)) == p; } +/* Used instead of source_load when we know the type == 0 */ +unsigned long weighted_cpuload(const int cpu) +{ + return cpu_rq(cpu)->raw_weighted_load; +} + #ifdef CONFIG_SMP typedef struct { struct list_head list; @@ -1150,7 +1156,7 @@ find_idlest_cpu(struct sched_group *grou cpus_and(tmp, group->cpumask, p->cpus_allowed); for_each_cpu_mask(i, tmp) { - load = source_load(i, 0); + load = weighted_cpuload(i); if (load < min_load || (load == min_load && i == this_cpu)) { min_load = load; @@ -2243,7 +2249,7 @@ static runqueue_t *find_busiest_queue(st int i; for_each_cpu_mask(i, group->cpumask) { - load = source_load(i, 0); + load = weighted_cpuload(i); if (load > max_load) { max_load = load; _