Re: [PATCH 2/2] sched/fair: Reimplement NEXT_BUDDY to align with EEVDF goals

From: Madadi Vineeth Reddy

Date: Thu Nov 13 2025 - 03:27:28 EST


Hi Peter,

On 12/11/25 20:18, Peter Zijlstra wrote:
> On Wed, Nov 12, 2025 at 12:25:21PM +0000, Mel Gorman wrote:
>
>> + /* Prefer picking wakee soon if appropriate. */
>> + if (sched_feat(NEXT_BUDDY) &&
>> + set_preempt_buddy(cfs_rq, wake_flags, pse, se)) {
>> +
>> + /*
>> + * Decide whether to obey WF_SYNC hint for a new buddy. Old
>> + * buddies are ignored as they may not be relevant to the
>> + * waker and less likely to be cache hot.
>> + */
>> + if (wake_flags & WF_SYNC)
>> + preempt_action = preempt_sync(rq, wake_flags, pse, se);
>> + }
>
> Why only do preempt_sync() when NEXT_BUDDY? Nothing there seems to
> depend on buddies.


IIUC, calling preempt_sync() Without NEXT_BUDDY would force a reschedule after the threshold,
but no buddy would be set. This means pick_eevdf() would run with normal EEVDF deadline selection,
potentially picking a different task instead of the wakee.The forced reschedule would accomplish
nothing for the wakees.

That said, I see your point that the WF_SYNC threshold check could still reduce context switch
overhead even without guaranteeing wakee selection.

Thanks,
Madadi Vineeth Reddy