sched/eevdf: Cancel slice protection if short slice task is eligible

If a short slice task will not be the next to be picked but is eligible,
we cancel the slice protection to speedup the time when the short slice
task will be the next to run.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://patch.msgid.link/20260624151229.1710703-5-vincent.guittot@linaro.org
This commit is contained in:
Vincent Guittot 2026-06-24 17:12:27 +02:00 committed by Peter Zijlstra
parent 7ad0ec7890
commit ba0d3bf5f9

View File

@ -9859,18 +9859,13 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f
cse_is_idle = se_is_idle(se); cse_is_idle = se_is_idle(se);
pse_is_idle = se_is_idle(pse); pse_is_idle = se_is_idle(pse);
nse = se;
/* /*
* Preempt an idle entity in favor of a non-idle entity (and don't preempt * Preempt an idle entity in favor of a non-idle entity (and don't preempt
* in the inverse case). * in the inverse case).
*/ */
if (cse_is_idle && !pse_is_idle) { if (cse_is_idle && !pse_is_idle)
/*
* When non-idle entity preempt an idle entity,
* don't give idle entity slice protection.
*/
preempt_action = PREEMPT_WAKEUP_SHORT;
goto preempt; goto preempt;
}
if (cse_is_idle != pse_is_idle) if (cse_is_idle != pse_is_idle)
return; return;
@ -9933,16 +9928,23 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f
goto preempt; goto preempt;
} }
/*
* 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;
if (sched_feat(RUN_TO_PARITY)) if (sched_feat(RUN_TO_PARITY))
update_protect_slice(cfs_rq, se); update_protect_slice(cfs_rq, se);
return; return;
preempt: preempt:
if (preempt_action == PREEMPT_WAKEUP_SHORT) {
cancel_protect_slice(se); cancel_protect_slice(se);
if (preempt_action == PREEMPT_WAKEUP_SHORT)
set_short_buddy(cfs_rq, pse); set_short_buddy(cfs_rq, pse);
}
resched_curr_lazy(rq); resched_curr_lazy(rq);
} }