From: Valentin Schneider <valentin.schneider@arm.com>
To: Peng Wang <rocking@linux.alibaba.com>
Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/fair: Simplify the code of should_we_balance()
Date: Mon, 13 Apr 2020 21:32:37 +0100 [thread overview]
Message-ID: <jhjzhbf6t2p.mognet@arm.com> (raw)
In-Reply-To: <6f372bce-151e-79e1-2fda-d8b2bcf777d6@linux.alibaba.com>
On 12/04/20 09:42, Peng Wang wrote:
> On 4/11/20 5:20 PM, Peng Wang wrote:
>> We only consider group_balance_cpu() after there is no idle
>> cpu. So, just do comparison before return at these two cases.
>>
It's not really changing much, but if it helps making it a bit more
readable, why not. Small nit below.
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
>> Signed-off-by: Peng Wang <rocking@linux.alibaba.com>
>> ---
>> kernel/sched/fair.c | 16 +++++-----------
>> 1 file changed, 5 insertions(+), 11 deletions(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 1ea3ddd..81b2c647 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -9413,7 +9413,7 @@ static int active_load_balance_cpu_stop(void *data);
>> static int should_we_balance(struct lb_env *env)
>> {
>> struct sched_group *sg = env->sd->groups;
>> - int cpu, balance_cpu = -1;
>> + int cpu;
>>
>> /*
>> * Ensure the balancing environment is consistent; can happen
>> @@ -9434,18 +9434,12 @@ static int should_we_balance(struct lb_env *env)
>> if (!idle_cpu(cpu))
>> continue;
>>
>> - balance_cpu = cpu;
>> - break;
>> + /* Are we the first idle CPU? */
>> + return cpu == env->dst_cpu;
>> }
>>
>> - 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.
>> - */
>> - return balance_cpu == env->dst_cpu;
>> + /* Are we the first balance CPU of this group? */
Nit: That should be either "the balance CPU" or "the first CPU in the group
balance mask"
>> + return group_balance_cpu(sg) == env->dst_cpu;
>> }
>>
>> /*
>>
>
> +juri.lelli@redhat.com
next prev parent reply other threads:[~2020-04-13 20:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-11 9:20 [PATCH] sched/fair: Simplify the code of should_we_balance() Peng Wang
2020-04-12 8:42 ` Peng Wang
2020-04-13 20:32 ` Valentin Schneider [this message]
2020-04-14 7:25 ` Vincent Guittot
2020-04-14 10:57 ` Peter Zijlstra
2020-04-14 8:48 ` [PATCH v2] " Peng Wang
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=jhjzhbf6t2p.mognet@arm.com \
--to=valentin.schneider@arm.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rocking@linux.alibaba.com \
--cc=rostedt@goodmis.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.