Re: [PATCH] sched/eevdf: fix rb augmented with multi fields
From: K Prateek Nayak
Date: Tue Sep 08 2026 - 17:47:45 EST
Hello Vincent,
On 9/8/2026 7:25 PM, Vincent Guittot wrote:
> The eevdf rb tree maintains 3 augmented fields but only one is currently
> copied when balancing the tree.
>
> Add a more generic define that can be used when there are several augmented
> fields. In this case, we provide a function that takes care of copying all
> fields.
>
> Fixes: aef6987d8954 ("sched/eevdf: Propagate min_slice up the cgroup hierarchy")
> Signed-off-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
I remember stumbling on this in
https://lore.kernel.org/lkml/20250220093257.9380-22-kprateek.nayak@xxxxxxx/
but working around the problem in the scheduler layer instead.
Generic rb-tree layer extension makes more sense. Feel free to include:
Reviewed-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
Tested-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
[..snip.]
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index db5937d7e46e..019812c4fe32 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1037,6 +1037,16 @@ static inline void __max_slice_update(struct sched_entity *se, struct rb_node *n
> }
> }
>
> +/*
> + * se->min_vruntime = min(se->vruntime, {left,right}->min_vruntime)
> + */
nit. Do we need this comment? It doesn't really describe the copy
callback.
> +static inline void min_vruntime_copy(struct sched_entity *new, struct sched_entity *old)
> +{
> + new->min_vruntime = old->min_vruntime;
> + new->min_slice = old->min_slice;
> + new->max_slice = old->max_slice;
> +}
> +
> /*
> * se->min_vruntime = min(se->vruntime, {left,right}->min_vruntime)
> */
The one over here above min_vruntime_update() makes sense and should
suffice IMO.
> @@ -1064,8 +1074,9 @@ static inline bool min_vruntime_update(struct sched_entity *se, bool exit)
> se->max_slice == old_max_slice;
> }
>
> -RB_DECLARE_CALLBACKS(static, min_vruntime_cb, struct sched_entity,
> - run_node, min_vruntime, min_vruntime_update);
> +
> +RB_DECLARE_CALLBACKS_MULTI(static, min_vruntime_cb, struct sched_entity,
> + run_node, min_vruntime_copy, min_vruntime_update);
>
> /*
> * Enqueue an entity into the rb-tree:
--
Thanks and Regards,
Prateek