From: Zhan Xusheng <zhanxusheng1024@gmail.com>
To: sh@gentwo.org
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,
vschneid@redhat.com, kprateek.nayak@amd.com, jstultz@google.com,
cl@os.amperecomputing.com, shubhang@os.amperecomputing.com,
linux-kernel@vger.kernel.org, zhanxusheng@xiaomi.com
Subject: Re: [PATCH v3] sched/core: Skip rq->avg_idle update without a valid idle_stamp
Date: Tue, 1 Sep 2026 10:44:38 +0800 [thread overview]
Message-ID: <20260901024438.1830934-1-zhanxusheng@xiaomi.com> (raw)
In-Reply-To: <746602fd-e9d5-128f-bd6c-e5ce7c756916@gentwo.org>
The diff of 4b603f1551a73 is its own evidence, which may be quicker to
look at than the description:
- if (rq->idle_stamp) {
- u64 delta = rq_clock(rq) - rq->idle_stamp;
+void update_rq_avg_idle(struct rq *rq)
+{
+ u64 delta = rq_clock(rq) - rq->idle_stamp;
The trigger moved on purpose, from the wakeup to idle switch-out. The
guard came off with it, and nothing about that fails to compile.
Two things about it that the changelog leaves narrower than they are.
rq->idle_stamp has exactly one setter, fair.c:14563, and it sits below the
ttwu_pending bail-out at 14555. So the reachable set is not the three
examples but any path into idle that misses that one line, and since
update_rq_avg_idle() zeroes the field on the way out, every such entry
starts from zero again.
The sample is not merely invalid, it saturates on the first hit.
update_avg() adds diff/8, so a rq_clock() of ~1e12 on a few minutes of
uptime moves avg_idle by ~1.25e11, against a clamp of
2*max_idle_balance_cost in the 1e4..1e5 range. Both places that consult
avg_idle to decide whether an idle interval was long enough to be worth
balancing, fair.c:14504 and 14584, then stop holding anything back. It
only ever adds newidle balancing, never removes it, which fits latency
reports rather than wrong results.
I also went looking for a stale stamp rather than a zero one and did not
find one: 14674 clears it when newidle actually pulled a task, so no idle
follows, and the other write is sched_init(). The field is either zero or
this idle period's rq_clock, which is what the restored guard splits on.
Reviewed-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
Thanks,
Zhan Xusheng
next prev parent reply other threads:[~2026-09-01 2:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 20:38 Shubhang Kaushik (Ampere)
2026-08-17 23:15 ` Shubhang
2026-08-18 8:02 ` Vincent Guittot
2026-08-31 18:17 ` Shubhang
2026-09-01 2:44 ` Zhan Xusheng [this message]
2026-09-02 7:22 ` [tip: sched/urgent] " tip-bot2 for Shubhang Kaushik (Ampere)
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=20260901024438.1830934-1-zhanxusheng@xiaomi.com \
--to=zhanxusheng1024@gmail.com \
--cc=bsegall@google.com \
--cc=cl@os.amperecomputing.com \
--cc=dietmar.eggemann@arm.com \
--cc=jstultz@google.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=sh@gentwo.org \
--cc=shubhang@os.amperecomputing.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=zhanxusheng@xiaomi.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®