mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Lafleur via B4 Relay <devnull+josh.lafleur.outlook.com@kernel.org>
To: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	 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>,
	 Gauri Patwardhan <gauri.patwardhan@nutanix.com>,
	 Phil Auld <pauld@redhat.com>,
	Harshit Agarwal <harshit@nutanix.com>,
	 Jon Kohler <jon@nutanix.com>,
	Seiji Nishikawa <snishika@redhat.com>
Cc: Rahul Chunduru <rahul.chunduru@nutanix.com>,
	 linux-kernel@vger.kernel.org,
	 "Josh Lafleur (Zipline)" <josh.lafleur@outlook.com>
Subject: [PATCH 2/2] sched/rt: Restore pinned candidates for PUSH_IPI balancing
Date: Mon, 23 Nov 2026 11:21:44 -0800	[thread overview]
Message-ID: <20261123-migrate-on-ipi-v1-2-eacfe7e4b808@outlook.com> (raw)
In-Reply-To: <20261123-migrate-on-ipi-v1-0-eacfe7e4b808@outlook.com>

From: "Josh Lafleur (Zipline)" <josh.lafleur@outlook.com>

Commit a7c81556ec4d ("sched: Fix migrate_disable() vs rt/dl
balancing") added a PUSH_IPI fallback for a migrate-disabled RT
candidate. It runs the stopper to move the running task so that the
pinned task can run on its current CPU.

Commit dae5c0292080 ("sched/rt,dl: Skip migrate-disabled tasks when
picking a push candidate") made the RT picker skip pinned candidates.
This avoids futile ordinary pushes, but also prevents the push-IPI
path from reaching that fallback.

Select migrate-disabled candidates on the PUSH_IPI path, while
continuing to skip them on ordinary pushes. An ordinary push can
therefore still reach a movable task behind a pinned one. Use the
same selection mode when retrying after a failed destination search;
the head recheck for ordinary candidates continues to skip pinned
tasks.

The preceding patch allows the stopper target to pass the head
recheck after the source rq lock is reacquired.

Fixes: dae5c0292080 ("sched/rt,dl: Skip migrate-disabled tasks when picking a push candidate")
---
 kernel/sched/rt.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 54a6533cffe07..bb0d125889bd1 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1866,7 +1866,7 @@ static int find_lowest_rq(struct task_struct *task)
 	return -1;
 }
 
-static struct task_struct *pick_next_pushable_task(struct rq *rq)
+static struct task_struct *pick_next_pushable_task(struct rq *rq, bool pull)
 {
 	struct plist_head *head = &rq->rt.pushable_tasks;
 	struct task_struct *i, *p = NULL;
@@ -1875,8 +1875,9 @@ static struct task_struct *pick_next_pushable_task(struct rq *rq)
 		return NULL;
 
 	plist_for_each_entry(i, head, pushable_tasks) {
-		/* skip tasks that cannot be migrated */
-		if (!task_on_cpu(rq, i) && !is_migration_disabled(i)) {
+		/* Only the push-IPI path can push the current task instead. */
+		if (!task_on_cpu(rq, i) &&
+		    (pull || !is_migration_disabled(i))) {
 			p = i;
 			break;
 		}
@@ -1941,7 +1942,7 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq)
 			 */
 			if (unlikely(is_migration_disabled(task) ||
 				     !cpumask_test_cpu(lowest_rq->cpu, &task->cpus_mask) ||
-				     (task != pick_next_pushable_task(rq) &&
+				     (task != pick_next_pushable_task(rq, false) &&
 				      !stopper_push))) {
 
 				double_unlock_balance(rq, lowest_rq);
@@ -1976,7 +1977,7 @@ static int push_rt_task(struct rq *rq, bool pull)
 	if (!rq->rt.overloaded)
 		return 0;
 
-	next_task = pick_next_pushable_task(rq);
+	next_task = pick_next_pushable_task(rq, pull);
 	if (!next_task)
 		return 0;
 
@@ -2051,7 +2052,7 @@ static int push_rt_task(struct rq *rq, bool pull)
 		 * run-queue and is also still the next task eligible for
 		 * pushing.
 		 */
-		task = pick_next_pushable_task(rq);
+		task = pick_next_pushable_task(rq, pull);
 		if (task == next_task) {
 			/*
 			 * The task hasn't migrated, and is still the next

-- 
2.53.0



      parent reply	other threads:[~2026-11-23 19:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 19:21 [PATCH 0/2] sched/rt: Restore the PUSH_IPI fallback for migration disabled next_task Josh Lafleur via B4 Relay
2026-11-23 19:21 ` [PATCH 1/2] sched/rt: Allow queued stopper targets past the pushable-head check Josh Lafleur via B4 Relay
2026-11-23 19:21 ` Josh Lafleur via B4 Relay [this message]

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=20261123-migrate-on-ipi-v1-2-eacfe7e4b808@outlook.com \
    --to=devnull+josh.lafleur.outlook.com@kernel.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=gauri.patwardhan@nutanix.com \
    --cc=harshit@nutanix.com \
    --cc=jon@nutanix.com \
    --cc=josh.lafleur@outlook.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=pauld@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rahul.chunduru@nutanix.com \
    --cc=rostedt@goodmis.org \
    --cc=snishika@redhat.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®