lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1364558306.5053.87.camel@laptop>
Date:	Fri, 29 Mar 2013 12:58:26 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Joonsoo Kim <iamjoonsoo.kim@....com>
Cc:	Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
	Mike Galbraith <efault@....de>, Paul Turner <pjt@...gle.com>,
	Alex Shi <alex.shi@...el.com>,
	Preeti U Murthy <preeti@...ux.vnet.ibm.com>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Morten Rasmussen <morten.rasmussen@....com>,
	Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH 2/5] sched: factor out code to should_we_balance()

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ