mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jemmy Wong <jemmywong512@gmail.com>
To: Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>
Cc: 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>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	Jemmy Wong <jemmywong512@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] sched/core: Check CFS bandwidth against the donor for NOHZ
Date: Thu,  8 Oct 2026 21:26:04 +0800	[thread overview]
Message-ID: <20261008132604.98242-4-jemmywong512@gmail.com> (raw)
In-Reply-To: <20261008132604.98242-1-jemmywong512@gmail.com>

sched_can_stop_tick() tests rq->curr, the execution context, for CFS
bandwidth. Quota is consumed by the donor, the scheduling context:
account_cfs_rq_runtime() charges rq->donor's cfs_rq, and
sched_fair_update_stop_tick() already passes the donor picked in
set_next_task_fair() to cfs_task_bw_constrained().

Test rq->donor in sched_can_stop_tick() as well, so both callers name
the task whose quota is consumed. The tick decision is unchanged:
both paths return before the bandwidth test unless nr_running == 1,
and proxy execution keeps the donor and the lock holder (curr) queued.
Without CONFIG_SCHED_PROXY_EXEC, curr and donor are a union and
therefore the same task.

No functional change.

Signed-off-by: Jemmy Wong <jemmywong512@gmail.com>
Assisted-by: LLM
---
 kernel/sched/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b2005fafae59..7eddbc14ddcb 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1477,9 +1477,11 @@ bool sched_can_stop_tick(struct rq *rq)
 	 * This check prevents clearing the bit if a newly enqueued task here is
 	 * dequeued by migrating while the constrained task continues to run.
 	 * E.g. going from 2->1 without going through pick_next_task().
+	 *
+	 * Test the donor, as sched_fair_update_stop_tick() does.
 	 */
-	if (__need_bw_check(rq, rq->curr)) {
-		if (cfs_task_bw_constrained(rq->curr))
+	if (__need_bw_check(rq, rq->donor)) {
+		if (cfs_task_bw_constrained(rq->donor))
 			return false;
 	}
 
-- 
2.54.0 (Apple Git-157)


  parent reply	other threads:[~2026-10-08 13:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 13:26 [PATCH 0/3] sched: Fix proxy-exec use of curr and donor Jemmy Wong
2026-10-08 13:26 ` [PATCH 1/3] sched/fair: Drive NUMA and cache tick work from the execution context Jemmy Wong
2026-10-08 13:26 ` [PATCH 2/3] sched/core: Flush pending runtime for " Jemmy Wong
2026-10-08 13:26 ` Jemmy Wong [this message]
2026-10-08 15:33 ` [PATCH 0/3] sched: Fix proxy-exec use of curr and donor Kayra Cizmeci
2026-10-09  3:41   ` Jemmy Wong
2026-10-09  4:07     ` Hui Su
2026-10-09  5:46       ` Jemmy Wong

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=20261008132604.98242-4-jemmywong512@gmail.com \
    --to=jemmywong512@gmail.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.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=tim.c.chen@linux.intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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®