From: Xin Zhao <jackzxcui1989@163.com>
To: aiqun.yu@oss.qualcomm.com
Cc: bsegall@google.com, dietmar.eggemann@arm.com,
jackzxcui1989@163.com, juri.lelli@redhat.com,
kprateek.nayak@amd.com, linux-kernel@vger.kernel.org,
mgorman@suse.de, mingo@redhat.com, peterz@infradead.org,
rostedt@goodmis.org, vincent.guittot@linaro.org,
vschneid@redhat.com
Subject: Re: [PATCH v3 1/2] sched/fair: Don't trigger active lb if src_rq->curr is CFS and not on_rq
Date: Tue, 16 Jun 2026 12:07:10 +0800 [thread overview]
Message-ID: <20260616040710.223458-1-jackzxcui1989@163.com> (raw)
In-Reply-To: <ea5aedcb-487d-4f4e-98fd-f98e83f0fe32@oss.qualcomm.com>
On Tue, 16 Jun 2026 11:06:54 +0800 "Aiqun(Maria) Yu" <aiqun.yu@oss.qualcomm.com> wrote:
> >> + * need to forcefully punt it away with active balance.
> >> + */
> >> + if ((busiest->curr->sched_class == &fair_sched_class) &&
> >> + !busiest->curr->on_rq)
>
> Still have the doubt why need to do active load balance when the current
> is not CFS. And busiest->curr->on_rq==0 case only.
>
> Is it should be like:
> if ((busiest->curr->sched_class == &fair_sched_class) ||
> unlikely(!task_on_rq_queued(busiest->curr)));
The platform I am using is quite close to actual usage, and the tasks
bound to different CPUs and different scheduling domains vary
significantly. From my data, there isn't a single CPU with an active
balance success rate below 50% under such scenarios. As for your earlier
comment that "just do detach_task and attach_task and the success rate
will be 100%", I believe you should take a closer look at the
implementation of active_load_balance_cpu_stop. That should make it clear
where the statistical code I previously sent you is located, instead of
simply questioning my approach of performing an ineffective "detach_task
and attach_task" operation to artificially inflate the success rate during
testing.
Regarding why the success rate of active balance is so high in this case,
I have my own reasonable explanations, and I prefer not to repeat them
over and over.
> if busiest->curr->on_rq==2 (TASK_ON_RQ_MIGRATING), it is no need to do
> active_balance as well.
There is a slight difference for the compiler between comparing == 1 and
comparing != 0. From my current understanding, comparing to a non-zero
value is generally faster than comparing to a specific number in most of
arch. I have previously tested whether on_rq would ever be equal to 2 and,
over a long period of time, I did not encounter a single instance where
on_rq was 2. This at least indicates that the probability is extremely
low, and it may even be theoretically impossible for such a situation to
occur.
Thanks
Xin Zhao
next prev parent reply other threads:[~2026-06-16 4:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 5:38 [PATCH v3 0/2] sched/fair: Optimize some active balance logic Xin Zhao
2026-06-15 5:38 ` [PATCH v3 1/2] sched/fair: Don't trigger active lb if src_rq->curr is CFS and not on_rq Xin Zhao
2026-06-15 13:39 ` Valentin Schneider
2026-06-15 13:57 ` Phil Auld
2026-06-15 14:09 ` Xin Zhao
2026-06-16 3:06 ` Aiqun(Maria) Yu
2026-06-16 4:07 ` Xin Zhao [this message]
2026-06-15 5:38 ` [PATCH v3 2/2] sched/fair: Simplify balance_interval reset logic in sched_balance_rq() Xin Zhao
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=20260616040710.223458-1-jackzxcui1989@163.com \
--to=jackzxcui1989@163.com \
--cc=aiqun.yu@oss.qualcomm.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.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®