Re: [PATCH] Fix longstanding load balancing bug in the scheduler.

From: Siddha, Suresh B
Date: Fri Sep 08 2006 - 13:48:10 EST


On Wed, Sep 06, 2006 at 04:38:33PM -0700, Christoph Lameter wrote:
> +int cpu_of(struct rq *rq)
> +{
> +#ifdef CONFIG_SMP
> + return rq->cpu;
> +#else
> + return 0;
> +#endif
> +}

Is there a reason why this is not made inline?

> static struct sched_group *
> find_busiest_group(struct sched_domain *sd, int this_cpu,
> - unsigned long *imbalance, enum idle_type idle, int
> *sd_idle)
> + unsigned long *imbalance, enum idle_type idle, int
> *sd_idle,
> + cpumask_t *cpus)
> {
> struct sched_group *busiest = NULL, *this = NULL, *group =
> sd->groups;
> unsigned long max_load, avg_load, total_load, this_load,
> total_pwr;
> @@ -2243,7 +2254,12 @@
> sum_weighted_load = sum_nr_running = avg_load = 0;
>
> for_each_cpu_mask(i, group->cpumask) {
> - struct rq *rq = cpu_rq(i);
> + struct rq *rq;
> +
> + if (!cpu_isset(i, *cpus))
> + continue;

In normal conditions can we make this "cpus" argument NULL and only set/use it
when we run into pinned condition? That will atleast avoid unnecessary memory
test bit operations in the normal case.

thanks,
suresh
-
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/