Re: [PATCH v3] sched/core: Skip rq->avg_idle update without a valid idle_stamp

From: Shubhang

Date: Mon Aug 17 2026 - 19:15:58 EST


Hello all,

Gentle ping for v3. I repeated the Hackbench comparison with multiple runs per kernel. The reported thread and process cases stayed within about 1.5% mean delta, with similar baseline run-to-run variation.

Please let me know if there are further concerns with this approach.

Thanks,
Shubhang Kaushik

On Fri, 7 Aug 2026, Shubhang Kaushik (Ampere) wrote:

Fixes: 4b603f1551a73 ("sched: Update rq->avg_idle when a task is moved to an idle CPU")
Reviewed-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
Acked-by: John Stultz <jstultz@xxxxxxxxxx>
Signed-off-by: Shubhang Kaushik (Ampere) <sh@xxxxxxxxxx>
---
Temporary tracing under hackbench load confirmed that
update_rq_avg_idle() can be reached with rq->idle_stamp == 0.
Hackbench showed no material regression versus v7.2-rc5 mainline.

Related discussion:
https://lore.kernel.org/r/20260423023322.1293923-1-firelzrd@xxxxxxxxx

This is a narrower variant of the earlier proposal. It keeps the
rq->idle_stamp guard in update_rq_avg_idle(), but intentionally does not
stamp idle entry from set_next_task_idle(), preserving the existing
newidle accounting model and avoiding force-idle/proxy-exec accounting
concerns.
---
Changes in v3:
- Describe the sched_balance_newidle()/ttwu_pending path as an
example of entering idle without a valid rq->idle_stamp.
- Drop unlikely() from the idle_stamp check.
- Add Acked-by from John Stultz.

Link to v2: https://lore.kernel.org/r/20260806-master-v2-1-e1f3a1a0c903@xxxxxxxxxx