Re: [PATCH] sched/rt: push a queued task when its priority is boosted

From: Chaosheng Qu

Date: Sat Nov 28 2026 - 00:51:47 EST


Thanks -- you are right on both counts, and the first one is a hole in the
patch as posted.

prio_changed_rt() only reaches resched_curr() when the boosted task outranks
the donor; my changelog was too short there.

The pushable entry is the real problem. @p is already on
rq->rt.pushable_tasks (enqueue_task_rt() added it when it was queued, and
nothing removes it while it stays queued), but the plist node and
rq->rt.highest_prio.next still hold the priority it had at enqueue time:
plist_node_init(&p->pushable_tasks, p->prio) and
enqueue/dequeue_pushable_task() are the only places that touch either. So
after a boost, pick_next_pushable_task() can hand back another task, and the
stale highest_prio.next also hides @p behind the
src_rq->rt.highest_prio.next >= this_rq->rt.highest_prio.curr filter in the
pull path. A push queued without re-adding the entry can therefore do
nothing.

v2 re-adds the entry at the new priority before queuing the push:

if (oldprio > p->prio && p->nr_cpus_allowed > 1) {
dequeue_pushable_task(rq, p);
enqueue_pushable_task(rq, p);
if (p->prio >= rq->donor->prio)
rt_queue_push_tasks(rq);
}

The p->prio >= rq->donor->prio guard is only there to skip the case
resched_curr() already handles: if the boost makes @p outrank the donor, the
local reschedule runs it and a push would be wasted work.

On RT_PUSH_IPI, your reading of the pull path is right. pull_rt_task()
walks rq->rd->rto_mask and pick_highest_pushable_task(src_rq, this_cpu) only
accepts a task whose cpus_mask contains the pulling CPU (task_is_pushable()
in sched.h). With the feature on, pull_rt_task() does not pull at all: it
calls tell_cpu_to_push() and the overloaded CPU pushes, so the source rq
chooses the destination through find_lowest_rq() using the task's own
cpus_mask, never the identity of the idle CPU. That is why the same
workload migrates with RT_PUSH_IPI on and sits behind the hog with it off --
the affinity filter moves from "can this idle CPU take it" to "which allowed
CPU is lowest priority".

The reproducer is a 4-vCPU QEMU guest (TCG; no KVM here), non-RT kernel,
RT_PUSH_IPI off. I can post it separately if Martin wants to run it before
v2 goes out.

Thanks,
Chaosheng