public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, Mike Galbraith <efault@gmx.de>,
	Paul Turner <pjt@google.com>, Alex Shi <alex.shi@intel.com>,
	Preeti U Murthy <preeti@linux.vnet.ibm.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Morten Rasmussen <morten.rasmussen@arm.com>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH 2/5] sched: factor out code to should_we_balance()
Date: Fri, 29 Mar 2013 12:58:26 +0100	[thread overview]
Message-ID: <1364558306.5053.87.camel@laptop> (raw)
In-Reply-To: <1364457537-15114-3-git-send-email-iamjoonsoo.kim@lge.com>

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;
> +}



  parent reply	other threads:[~2013-03-29 11:58 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28  7:58 [PATCH 0/5] optimization, clean-up, correctness about fair.c Joonsoo Kim
2013-03-28  7:58 ` [PATCH 1/5] sched: remove one division operation in find_buiest_queue() Joonsoo Kim
2013-03-28  7:58 ` [PATCH 2/5] sched: factor out code to should_we_balance() Joonsoo Kim
2013-03-29 11:45   ` Peter Zijlstra
2013-04-01  5:10     ` Joonsoo Kim
2013-03-29 11:58   ` Peter Zijlstra [this message]
2013-04-01  5:16     ` Joonsoo Kim
2013-04-02  8:10   ` Peter Zijlstra
2013-04-02  9:50     ` Joonsoo Kim
2013-04-02 10:00       ` Peter Zijlstra
2013-04-02 10:29         ` Peter Zijlstra
2013-04-04  0:55           ` Joonsoo Kim
2013-03-28  7:58 ` [PATCH 3/5] sched: clean-up struct sd_lb_stat Joonsoo Kim
2013-03-28  7:58 ` [PATCH 4/5] sched: don't consider upper se in sched_slice() Joonsoo Kim
2013-03-29  7:12   ` Preeti U Murthy
2013-04-01  4:08     ` Joonsoo Kim
2013-04-01  7:06       ` Preeti U Murthy
2013-04-02  2:25         ` Joonsoo Kim
2013-04-02  2:35           ` Mike Galbraith
2013-04-02  9:35             ` Joonsoo Kim
2013-04-02  4:55           ` Preeti U Murthy
2013-04-02  9:26             ` Joonsoo Kim
2013-04-02 17:32               ` Preeti U Murthy
2013-04-04  0:42                 ` Joonsoo Kim
2013-04-04  6:48                   ` Preeti U Murthy
2013-04-05  2:06                     ` Joonsoo Kim
2013-03-28  7:58 ` [PATCH 5/5] sched: limit sched_slice if it is more than sysctl_sched_latency Joonsoo Kim
2013-03-29 11:35   ` Preeti U Murthy
2013-04-01  5:09     ` Joonsoo Kim
2013-04-01  6:45       ` Preeti U Murthy
2013-04-02  2:02         ` Joonsoo Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364558306.5053.87.camel@laptop \
    --to=peterz@infradead.org \
    --cc=alex.shi@intel.com \
    --cc=efault@gmx.de \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=morten.rasmussen@arm.com \
    --cc=namhyung@kernel.org \
    --cc=pjt@google.com \
    --cc=preeti@linux.vnet.ibm.com \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox