Re: [PATCH v2] sched/fair: Prefer waker CPU for reciprocal sync wakeups

From: K Prateek Nayak

Date: Thu Jul 23 2026 - 02:29:21 EST


Hello Christian,

On 7/23/2026 11:41 AM, Christian Loehle wrote:
>> +/*
>> + * For reciprocal WF_SYNC handoffs, prefer the waker CPU when it has no
>> + * other runnable fair task.
>> + */
>> +static bool prefer_sync_pair_cpu(struct task_struct *p, int cpu)
>> +{
>> + struct rq *rq = cpu_rq(cpu);
>> +
>> + if ((rq->nr_running - cfs_h_nr_delayed(rq)) != 1)
>> + return false;
>> +
>> + if (!cpumask_test_cpu(cpu, p->cpus_ptr))
>> + return false;
>> +
>> + if (sched_asym_cpucap_active()) {
>> + sync_entity_load_avg(&p->se);
>> + if (!task_fits_cpu(p, cpu))
>> + return false;
>> + }
>> +
>> + return true;
>> +}
>
> Maybe @Prateek:
> What about SMT, would we want to require the sibling to be idle too?

I think we should pass the wake_flags to select_idle_sibling() and do
an early return there within the (sched_smt_active() && !has_idle_core)
block.

> I would appreciate a bench sched pipe on SMT result, if Shubhang doesn't
> have one I can dust one off, too.

Let me give it a spin on my end too.

--
Thanks and Regards,
Prateek