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 1/2] sched/rt: Allow queued stopper targets past the pushable-head check
Date: Mon, 23 Nov 2026 11:21:43 -0800	[thread overview]
Message-ID: <20261123-migrate-on-ipi-v1-1-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 stopper push when RT balancing cannot push a
migrate-disabled task which moves the running task so the pinned
task can run locally. The PUSH_IPI path can request the same fallback
when it selects a pinned push candidate.

Commit 690e47d1403e ("sched/rt: Fix race in push_rt_task") added a
pushable-head check after find_lock_lowest_rq() drops and reacquires
the source rq lock. That check protects ordinary pushes, but can
reject a queued stopper target when another task remains ahead of it
in the pushable list. The stopper then gives up without moving the
task. Since we know in the stopper push case the rq is actively
owning the last running task and the rq is push_busy, we can be
confident that it will not be migrated between the push_rt_task()
and subsequent stopper handler.

Allow a queued stopper target that is still on the source rq to pass
the head comparison. Keep the migration-disable and affinity checks,
and retain the head comparison for ordinary pushes. This also makes
the PUSH_IPI fallback usable when pinned candidates are selected by
the following patch.

Fixes: 690e47d1403e ("sched/rt: Fix race in push_rt_task")
---
 kernel/sched/rt.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 1535046a23ffa..54a6533cffe07 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1923,19 +1923,26 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq)
 
 		/* if the prio of this runqueue changed, try again */
 		if (double_lock_balance(rq, lowest_rq)) {
+			bool stopper_push = rq->push_busy &&
+					    (rq->curr == rq->stop) &&
+					    (task_rq(task) == rq) &&
+					    task_on_rq_queued(task);
+
 			/*
 			 * We had to unlock the run queue. In
 			 * the mean time, task could have
 			 * migrated already or had its affinity changed,
 			 * therefore check if the task is still at the
-			 * head of the pushable tasks list.
+			 * head of the pushable tasks list. A queued stopper
+			 * target need not be at the head of that list.
 			 * It is possible the task was scheduled, set
 			 * "migrate_disabled" and then got preempted, so we must
 			 * check the task migration disable flag here too.
 			 */
 			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) &&
+				      !stopper_push))) {
 
 				double_unlock_balance(rq, lowest_rq);
 				lowest_rq = NULL;

-- 
2.53.0



  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 ` Josh Lafleur via B4 Relay [this message]
2026-11-23 19:21 ` [PATCH 2/2] sched/rt: Restore pinned candidates for PUSH_IPI balancing Josh Lafleur via B4 Relay

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-1-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®