mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhan Xusheng <zhanxusheng1024@gmail.com>
To: "Shubhang Kaushik (Ampere)" <sh@gentwo.org>
Cc: Zhan Xusheng <zhanxusheng@xiaomi.com>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	John Stultz <jstultz@google.com>,
	Christopher Lameter <cl@os.amperecomputing.com>,
	Shubhang Kaushik <shubhang@os.amperecomputing.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sched/core: Skip rq->avg_idle update without a valid idle_stamp
Date: Fri,  7 Aug 2026 10:45:40 +0800	[thread overview]
Message-ID: <20260807024541.1136441-1-zhanxusheng@xiaomi.com> (raw)
In-Reply-To: <20260806-master-v2-1-e1f3a1a0c903@gentwo.org>

On Thu, 06 Aug 2026 17:26:27 -0700, Shubhang Kaushik (Ampere) wrote:
> This can happen when the scheduler switches to the idle task through a
> path that did not set rq->idle_stamp via newidle_balance(), for example
> during find_proxy_task() or force-idling.

There is a path that needs no config option, and I suspect it is what
your hackbench tracing actually hit: sched_balance_newidle() returns
before it stamps.

	if (this_rq->ttwu_pending)
		return 0;
	...
	this_rq->idle_stamp = rq_clock(this_rq);

The early return sits above the assignment, and its own comment says the
task will be enqueued when switching to idle.  So the rq goes idle with
idle_stamp == 0 and leaves idle again as soon as the pending wakeup is
processed, which is exactly when put_prev_task_idle() consumes the
stamp.  A wakeup-heavy load like hackbench should hit that constantly,
whereas find_proxy_task() and force-idling need proxy exec or
CONFIG_SCHED_CORE.  (Force-idle is the sched_core_enabled(rq) return at
the idle: label in pick_next_task_fair(), which is also above the
newidle call.)

Worth naming ttwu_pending in the changelog?  It makes the bug
config-independent, which seems relevant given the Fixes: tag.

The fix itself looks equivalent to what 4b603f1551a7 removed: the old
ttwu_do_activate() code was wrapped in if (rq->idle_stamp), and skipping
the trailing rq->idle_stamp = 0 is a no-op when the stamp is already
zero.  update_rq_avg_idle() has just the one caller, so nothing else
changes.

Nit: unlikely(!idle_stamp) may be the wrong way round if ttwu_pending is
the common trigger.

Thanks,
Zhan Xusheng

  parent reply	other threads:[~2026-08-07  2:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07  0:26 Shubhang Kaushik (Ampere)
2026-08-07  1:01 ` John Stultz
2026-08-07  2:45 ` Zhan Xusheng [this message]
2026-08-07 20:24   ` Shubhang

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=20260807024541.1136441-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®