Re: [PATCH 4/6 v2] sched/eevdf: Cancel slice protection if short slice task is eligible

From: K Prateek Nayak

Date: Tue Jun 16 2026 - 01:34:24 EST


Hello Vincent,

On 6/15/2026 9:54 PM, Vincent Guittot wrote:
> @@ -9897,16 +9892,23 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f
> if (!nse && cfs_rq->nr_queued)
> goto pick;
>
> + /*
> + * If @p is eligible but not the next task to run then cancel protection
> + * to prevent large scheduling latency
> + */
> + if (preempt_action == PREEMPT_WAKEUP_SHORT && entity_eligible(cfs_rq, pse))
> + goto preempt;

Can't we do this independent of the "pick" path if we are going to
resched anyways?

I suppose it is for set_next_buddy() bits but, if nse == pse, we cancel
the slice protection and resched anyways and the pick will naturally
go to pse so does set_next_buddy() even matter?

Instead, can PREEMPT_WAKEUP_SHORT path just do a set_preempt_buddy()
beforehand to ensure the task with the smallest deadline is already
the ->next and pick_next_entity() readily returns that?

> +
> if (sched_feat(RUN_TO_PARITY))
> update_protect_slice(cfs_rq, se);
>
> return;
>
> preempt:
> - if (preempt_action == PREEMPT_WAKEUP_SHORT) {
> - cancel_protect_slice(se);
> + cancel_protect_slice(se);
> +
> + if (preempt_action == PREEMPT_WAKEUP_SHORT && nse == pse)
> set_next_buddy(&p->se);
> - }
>
> resched_curr_lazy(rq);
> }

--
Thanks and Regards,
Prateek