lkml.org 
[lkml]   [2013]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/5] sched: factor out code to should_we_balance()
On Fri, Mar 29, 2013 at 12:58:26PM +0100, Peter Zijlstra wrote:
> 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!

Thanks!

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

Okay. I will do that when respin.

Thanks.

>
> > +
> > + 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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/


\
 
 \ /
  Last update: 2013-04-01 07:41    [W:0.159 / U:1.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site