Re: [PATCH 4/6 v3] sched/eevdf: Cancel slice protection if short slice task is eligible
From: K Prateek Nayak
Date: Thu Jun 25 2026 - 02:01:14 EST
Hello Vincent,
On 6/24/2026 8:42 PM, Vincent Guittot wrote:
> @@ -9896,16 +9891,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;
We handle "pse->slice < se->slice" case before "pse->sched_delayed" case
and jump to "pick", but pse can get dequeued as a part of
pick_next_entity() if it was delayed and picked.
I think we can reach here for PREEMPT_WAKEUP_SHORT after pse is
completely dequeued from cfs_rq. If p is a task on root cfs_rq, we could
have blocked the task entirely and ideally it shouldn't be referenced
here.
Since a wakeup of delayed entity / on delayed hierarchy will call
wakeup_preempt() anyways, I think we should return early if we should
directly jump to update if we see "pse->sched_delayed".
> +
> 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