On Thu, 2013-03-28 at 16:58 +0900, Joonsoo Kim wrote:
> +static int should_we_balance(struct lb_env *env)
> +{
> +       struct sched_group *sg = env->sd->groups;
> +       int cpu, balance_cpu = -1;
> +
> +       /*
> +        * In the newly idle case, we will allow all the cpu's
> +        * to do the newly idle load balance.
> +        */
> +       if (env->idle == CPU_NEWLY_IDLE)
> +               return 1;
> +
> +       /* Try to find first idle cpu */
> +       for_each_cpu_and(cpu, sched_group_cpus(sg), env->cpus)
> +               if (cpumask_test_cpu(cpu, sched_group_mask(sg)) &&
> +                       idle_cpu(cpu)) {
> +                               balance_cpu = cpu;
> +                               break;
> +                       }

/me hands you a bucket of curlies too.. use them I'll send you another
bucket when this one gets empty!

(We always put in curlies on multi lines statements -- as opposed to
multi statement blocks where they're required)

> +
> +       if (balance_cpu == -1)
> +               balance_cpu = group_balance_cpu(sg);
> +
> +       /*
> +        * First idle cpu or the first cpu(busiest) in this sched
> group
> +        * is eligible for doing load balancing at this and above
> domains.
> +        */
> +       if (balance_cpu != env->dst_cpu)
> +               return 0;
> +
> +       return 1;
> +}


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

Reply via email to