mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Wanwu Li" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Wanwu Li <liwanwu@kylinos.cn>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Aaron Lu <ziqianlu@bytedance.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/urgent] sched/fair: Use cfs_rq->h_curr in distribute_cfs_runtime()
Date: Wed, 02 Sep 2026 07:21:59 -0000	[thread overview]
Message-ID: <178833371909.3717435.9905002541865201334.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260831101141.391382-3-liwanwu@kylinos.cn>

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@kylinos.cn>
AuthorDate:    Mon, 31 Aug 2026 18:11:41 +08:00
Committer:     Peter Zijlstra <peterz@infradead.org>
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@kylinos.cn>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Aaron Lu <ziqianlu@bytedance.com>
Tested-by: Aaron Lu <ziqianlu@bytedance.com>
Link: https://patch.msgid.link/20260831101141.391382-3-liwanwu@kylinos.cn
---
 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);
 		}

  reply	other threads:[~2026-09-02  7:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 10:11 [PATCH 0/2] sched/fair: Use cfs_rq->h_curr in the bandwidth paths Wanwu Li
2026-08-31 10:11 ` [PATCH 1/2] sched/fair: Use cfs_rq->h_curr in throttle_cfs_rq() Wanwu Li
2026-09-02  7:22   ` [tip: sched/urgent] " tip-bot2 for Wanwu Li
2026-08-31 10:11 ` [PATCH 2/2] sched/fair: Use cfs_rq->h_curr in distribute_cfs_runtime() Wanwu Li
2026-09-02  7:21   ` tip-bot2 for Wanwu Li [this message]
2026-09-01  2:38 ` [PATCH 0/2] sched/fair: Use cfs_rq->h_curr in the bandwidth paths Aaron Lu
2026-09-01  4:09   ` Wanwu Li
2026-09-01  4:09   ` Wanwu Li

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=178833371909.3717435.9905002541865201334.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=liwanwu@kylinos.cn \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    --cc=ziqianlu@bytedance.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®