[tip: sched/core] sched/eevdf: Take into account current's lag when updating slice protection
From: tip-bot2 for Vincent Guittot
Date: Tue Jun 30 2026 - 05:05:23 EST
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 49f87b4d0be8b440a040e998b155ed5379223871
Gitweb: https://git.kernel.org/tip/49f87b4d0be8b440a040e998b155ed5379223871
Author: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
AuthorDate: Wed, 24 Jun 2026 17:12:25 +02:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Tue, 30 Jun 2026 10:56:54 +02:00
sched/eevdf: Take into account current's lag when updating slice protection
Take into account the lag of current task when updating the slice
protection in order to ensure that the absolute value of lags will remain
in the range [0 : slice+tick]
A task that already has a negative lag will see its protection reduced
whereas a task with positive lag will keep a full slice protection.
Signed-off-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Tested-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
Link: https://patch.msgid.link/20260624151229.1710703-3-vincent.guittot@xxxxxxxxxx
---
kernel/sched/fair.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 976cc3c..cadbb11 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1067,8 +1067,9 @@ static inline void set_protect_slice(struct cfs_rq *cfs_rq, struct sched_entity
static inline void update_protect_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
{
u64 slice = cfs_rq_min_slice(cfs_rq);
+ u64 vruntime = min_vruntime(se->vruntime, avg_vruntime(cfs_rq));
- se->vprot = min_vruntime(se->vprot, se->vruntime + calc_delta_fair(slice, se));
+ se->vprot = min_vruntime(se->vprot, vruntime + calc_delta_fair(slice, se));
}
static inline bool protect_slice(struct sched_entity *se)