Re: [PATCH v3 09/20] sched/rt: Select a preferred CPU for wakeup and pulling rt task

From: Shrikanth Hegde

Date: Tue Jun 09 2026 - 07:35:32 EST


Hi Peter. Thanks for taking a look at the patches.

On 6/9/26 4:55 PM, Peter Zijlstra wrote:
On Thu, May 14, 2026 at 08:51:53PM +0530, Shrikanth Hegde wrote:
For RT class,
- During wakeup choose a preferred CPU.
- For push_rt framework, limit pushing to preferred CPUs
- Pull the rt task only if CPU is preferred.

So this one might have the potential to break things. Preferring a
preferred cpu, sure, but to the exclusion of active, perhaps not.


I don't think we are excluding active.

Also, where are the DL changes?

DL changes are not there. The reason being on such systems running DL tasks will not make sense as timelines are subjected to vCPU preemption and there is no easy way to force run a vCPU.

RT is not a primary use case too. But have seen a few workload spawn RT tasks today. So it is there.


Signed-off-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
---
kernel/sched/cpupri.c | 1 +
kernel/sched/rt.c | 4 ++++
2 files changed, 5 insertions(+)

diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c
index 8f2237e8b484..24eb26ea9a91 100644
--- a/kernel/sched/cpupri.c
+++ b/kernel/sched/cpupri.c
@@ -103,6 +103,7 @@ static inline int __cpupri_find(struct cpupri *cp, struct task_struct *p,
if (lowest_mask) {
cpumask_and(lowest_mask, &p->cpus_mask, vec->mask);
cpumask_and(lowest_mask, lowest_mask, cpu_active_mask);
+ cpumask_and(lowest_mask, lowest_mask, cpu_preferred_mask);


It is both active and preferred. No?

/*
* We have to ensure that we have at least one bit
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 4ee8faf01441..62c53f10de24 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2262,6 +2262,10 @@ static void pull_rt_task(struct rq *this_rq)
if (likely(!rt_overload_count))
return;
+ /* No point in pulling the load, just to push it next tick again */
+ if (!cpu_preferred(this_cpu))
+ return;
+
/*
* Match the barrier from rt_set_overloaded; this guarantees that if we
* see overloaded we must also see the rto_mask bit.
--
2.47.3