[PATCH 6/6 v2] sched/eevdf: Speedup short slice task scheduling

From: Vincent Guittot

Date: Mon Jun 15 2026 - 12:31:35 EST


When a task with a shorter slice is enqueued, we protect the running
task which has a longer slice until it becomes ineligible instead of a
full slice in order to speedup the switch to other tasks until the task
with the shortest slice is scheduled. This helps to the task to not wait
too many full slices before running.

Signed-off-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
---
kernel/sched/fair.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 601c67cff185..994fcf3ea702 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1091,7 +1091,10 @@ static inline void set_protect_slice(struct cfs_rq *cfs_rq, struct sched_entity
slice = cfs_rq_min_slice(cfs_rq);

slice = min(slice, se->slice);
- if (vruntime != se->vruntime || slice != se->slice)
+
+ if (sched_feat(PREEMPT_SHORT) && slice < se->slice)
+ vprot = avg_vruntime(cfs_rq);
+ else if ((vruntime != se->vruntime) || (slice != se->slice))
vprot = min_vruntime(vprot, vruntime + calc_delta_fair(slice, se));

se->vprot = vprot;
--
2.43.0