From: Abel Wu <wuyun.abel@bytedance.com>
To: Miaohe Lin <linmiaohe@huawei.com>,
mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org
Cc: dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, bristot@redhat.com,
vschneid@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/fair: fix possible active balance misbehavior
Date: Wed, 21 Jun 2023 15:36:53 +0800 [thread overview]
Message-ID: <0a2c3d52-a964-d987-5808-88f09515d5be@bytedance.com> (raw)
In-Reply-To: <20230621065331.3793767-1-linmiaohe@huawei.com>
Hi Miaohe,
On 6/21/23 2:53 PM, Miaohe Lin wrote:
> In LBF_DST_PINNED case, env.dst_cpu won't be equal to this_cpu. So when
> need_active_balance() returns true, env.dst_cpu should be used to do the
> active balance stuff instead of this_cpu.
Active LB is the last resort to balance loads, which means no task
found can be moved to the local group before we actually do active lb.
So I don't think there is much difference between this cpu and the
selected new dst_cpu, as they are both in the local sched group and
the sched group is treated as a whole in point of view of balancing.
Best,
Abel
>
> Fixes: 88b8dac0a14c ("sched: Improve balance_cpu() to consider other cpus in its group as target of (pinned) task")
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> kernel/sched/fair.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 5e90e9658528..28ff831ee847 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -10968,14 +10968,14 @@ static int load_balance(int this_cpu, struct rq *this_rq,
> /*
> * Don't kick the active_load_balance_cpu_stop,
> * if the curr task on busiest CPU can't be
> - * moved to this_cpu:
> + * moved to env.dst_cpu:
> */
> - if (!cpumask_test_cpu(this_cpu, busiest->curr->cpus_ptr)) {
> + if (!cpumask_test_cpu(env.dst_cpu, busiest->curr->cpus_ptr)) {
> raw_spin_rq_unlock_irqrestore(busiest, flags);
> goto out_one_pinned;
> }
>
> - /* Record that we found at least one task that could run on this_cpu */
> + /* Record that we found at least one task that could run on env.dst_cpu */
> env.flags &= ~LBF_ALL_PINNED;
>
> /*
> @@ -10985,7 +10985,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
> */
> if (!busiest->active_balance) {
> busiest->active_balance = 1;
> - busiest->push_cpu = this_cpu;
> + busiest->push_cpu = env.dst_cpu;
> active_balance = 1;
> }
> raw_spin_rq_unlock_irqrestore(busiest, flags);
prev parent reply other threads:[~2023-06-21 7:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 6:53 Miaohe Lin
2023-06-21 7:36 ` Abel Wu [this message]
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=0a2c3d52-a964-d987-5808-88f09515d5be@bytedance.com \
--to=wuyun.abel@bytedance.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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
all inboxes | Powered by JetHome®