Re: [PATCH 2/6 v2] sched/eevdf: Take into account current's lag when updating slice protection

From: K Prateek Nayak

Date: Mon Jun 15 2026 - 23:52:40 EST


Hello Vincent,

On 6/15/2026 9:54 PM, Vincent Guittot wrote:
> @@ -1083,6 +1083,7 @@ struct sched_entity *__pick_first_entity(struct cfs_rq *cfs_rq)
> */
> static inline void set_protect_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
> {
> + u64 vruntime = min_vruntime(se->vruntime, avg_vruntime(cfs_rq));

set_protect_slice() is only called for set_next_entity(... first = true)
which has to come from the pick where the entity has to be eligible and
behind the avg_vruntime(cfs_rq) right?

Is there a case where se->vruntime is ahead of the average here that
I'm missing?

> u64 slice = normalized_sysctl_sched_base_slice;
> u64 vprot = se->deadline;
>
> @@ -1090,8 +1091,8 @@ 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 (slice != se->slice)
> - vprot = min_vruntime(vprot, se->vruntime + calc_delta_fair(slice, se));
> + if (vruntime != se->vruntime || slice != se->slice)
> + vprot = min_vruntime(vprot, vruntime + calc_delta_fair(slice, se));
>
> se->vprot = vprot;
> }
--
Thanks and Regards,
Prateek