[tip: sched/urgent] sched/fair: Use cfs_rq->h_curr in distribute_cfs_runtime()
From: tip-bot2 for Wanwu Li
Date: Wed Sep 02 2026 - 03:25:51 EST
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: b038383526d8c7883ea0486dd1911102b6dda414
Gitweb: https://git.kernel.org/tip/b038383526d8c7883ea0486dd1911102b6dda414
Author: Wanwu Li <liwanwu@xxxxxxxxxx>
AuthorDate: Mon, 31 Aug 2026 18:11:41 +08:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Wed, 02 Sep 2026 09:17:50 +02:00
sched/fair: Use cfs_rq->h_curr in distribute_cfs_runtime()
distribute_cfs_runtime() refreshes the rq clock and accounts elapsed
runtime with update_curr() before redistributing bandwidth, but gates
this on cfs_rq->curr. Since commit 85570f10a4c6 ("sched/eevdf: Move to
a single runqueue") cfs_rq->curr is only maintained on the root
cfs_rq, so for the cgroup cfs_rqs it walks, the check never fires and
the refresh is dead code.
Use cfs_rq->h_curr, the per-level current entity, restoring the
intended behaviour: only refresh when something is actually running at
the throttled level, i.e. within the deferred throttle window.
Without this, runtime consumed by a still-running task of the
throttled hierarchy is not docked before redistribution;
unthrottle_cfs_rq() catches up unconditionally since
commit 28ad5427682b ("sched/fair: Call update_curr() before
unthrottling the hierarchy"), so this is not a correctness hole today,
but the refresh the check was written for is gone.
Fixes: 85570f10a4c6 ("sched/eevdf: Move to a single runqueue")
Signed-off-by: Wanwu Li <liwanwu@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Reviewed-by: Aaron Lu <ziqianlu@xxxxxxxxxxxxx>
Tested-by: Aaron Lu <ziqianlu@xxxxxxxxxxxxx>
Link: https://patch.msgid.link/20260831101141.391382-3-liwanwu@xxxxxxxxxx
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 73797d6..97021a5 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7192,7 +7192,7 @@ static bool distribute_cfs_runtime(struct cfs_bandwidth *cfs_b)
if (!list_empty(&cfs_rq->throttled_csd_list))
continue;
- if (cfs_rq->curr) {
+ if (cfs_rq->h_curr) {
update_rq_clock(rq);
update_curr(cfs_rq);
}