mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liang Hao <haohlliang@gmail.com>
To: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Luca Abeni <luca.abeni@santannapisa.it>,
	Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: 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>,
	linux-kernel@vger.kernel.org, Liang Hao <haohlliang@gmail.com>
Subject: [PATCH] sched/deadline: Do not pull when the local CPU is the only overloaded one
Date: Fri,  7 Aug 2026 23:07:09 +0800	[thread overview]
Message-ID: <20260807150709.47181-1-haohlliang@gmail.com> (raw)

Mirror the short-circuit added to pull_rt_task() by commit f73c52a5bcd1
("sched/rt: Do not pull from current CPU if only one CPU to pull"):
when dlo_count == 1 and the local CPU owns the sole dlo_mask bit, the
for_each_cpu() loop skips this_cpu on every iteration and does nothing.
Return early instead.

pull_dl_task() shares the same overload-tracking design as the RT side
-- dl_set_overload() mirrors rt_set_overload(), incrementing rd->dlo_count
after an smp_wmb() that pairs with the smp_rmb() in the pull path -- but
never got the matching check.  DEADLINE has no RT_PUSH_IPI path, so this
is the symmetric short-circuit only.

No functional change.

Signed-off-by: Liang Hao <haohlliang@gmail.com>
---
 kernel/sched/deadline.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 857dbe3519a8..c3e38d4f3365 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -3222,8 +3222,9 @@ static void pull_dl_task(struct rq *this_rq)
 	bool resched = false;
 	struct rq *src_rq;
 	u64 dmin = LONG_MAX;
+	int dl_overload_count = dl_overloaded(this_rq);
 
-	if (likely(!dl_overloaded(this_rq)))
+	if (likely(!dl_overload_count))
 		return;
 
 	/*
@@ -3232,6 +3233,11 @@ static void pull_dl_task(struct rq *this_rq)
 	 */
 	smp_rmb();
 
+	/* If we are the only overloaded CPU do nothing */
+	if (dl_overload_count == 1 &&
+	    cpumask_test_cpu(this_rq->cpu, this_rq->rd->dlo_mask))
+		return;
+
 	for_each_cpu(cpu, this_rq->rd->dlo_mask) {
 		if (this_cpu == cpu)
 			continue;
-- 
2.50.1 (Apple Git-155)


                 reply	other threads:[~2026-08-07 15:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260807150709.47181-1-haohlliang@gmail.com \
    --to=haohlliang@gmail.com \
    --cc=bristot@kernel.org \
    --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=luca.abeni@santannapisa.it \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --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®