Re: [PATCH v2 4/7] sched/fair: Fix lag clamp

From: Dietmar Eggemann

Date: Mon Feb 23 2026 - 05:31:54 EST


On 19.02.26 08:58, Peter Zijlstra wrote:

[...]

> @@ -761,17 +763,16 @@ u64 avg_vruntime(struct cfs_rq *cfs_rq)
> * EEVDF gives the following limit for a steady state system:
> *
> * -r_max < lag < max(r_max, q)
> - *
> - * XXX could add max_slice to the augmented data to track this.
> */
> static void update_entity_lag(struct cfs_rq *cfs_rq, struct sched_entity *se)
> {
> + u64 max_slice = cfs_rq_max_slice(cfs_rq) + TICK_NSEC;
> s64 vlag, limit;
>
> WARN_ON_ONCE(!se->on_rq);
>
> vlag = avg_vruntime(cfs_rq) - se->vruntime;
> - limit = calc_delta_fair(max_t(u64, 2*se->slice, TICK_NSEC), se);
> + limit = calc_delta_fair(max_slice, se);
>
> se->vlag = clamp(vlag, -limit, limit);
> }

nitpick:

The "Limit this to either double the slice length with a minimum of
TICK_NSEC ..." in the function comment header doesn't match anymore.