Re: [RFC PATCH v4 11/28] sched/deadline: Account rt-cgroups bandwidth in deadline tasks schedulability tests.
From: Juri Lelli
Date: Mon Jan 19 2026 - 09:00:56 EST
Hello,
On 01/12/25 13:41, Yuri Andriaccio wrote:
> From: luca abeni <luca.abeni@xxxxxxxxxxxxxxx>
>
> Account the rt-cgroups hierarchy's reserved bandwidth in the
> schedulability test of deadline entities. This mechanism allows to
> completely reserve portion of the rt-bandwidth to rt-cgroups even if
> they do not use all of it.
>
> Account for the rt-cgroups' reserved bandwidth also when changing the
> total dedicated bandwidth for real time tasks.
>
> Co-developed-by: Alessio Balsini <a.balsini@xxxxxxxx>
> Signed-off-by: Alessio Balsini <a.balsini@xxxxxxxx>
> Co-developed-by: Andrea Parri <parri.andrea@xxxxxxxxx>
> Signed-off-by: Andrea Parri <parri.andrea@xxxxxxxxx>
> Co-developed-by: Yuri Andriaccio <yurand2000@xxxxxxxxx>
> Signed-off-by: Yuri Andriaccio <yurand2000@xxxxxxxxx>
> Signed-off-by: luca abeni <luca.abeni@xxxxxxxxxxxxxxx>
> ---
> kernel/sched/deadline.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 4f43883a65..089fd2c9b7 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -213,8 +213,15 @@ void __dl_add(struct dl_bw *dl_b, u64 tsk_bw, int cpus)
> static inline bool
> __dl_overflow(struct dl_bw *dl_b, unsigned long cap, u64 old_bw, u64 new_bw)
> {
> + u64 dl_groups_root = 0;
> +
> +#ifdef CONFIG_RT_GROUP_SCHED
> + dl_groups_root = to_ratio(root_task_group.dl_bandwidth.dl_period,
> + root_task_group.dl_bandwidth.dl_runtime);
> +#endif
> return dl_b->bw != -1 &&
> - cap_scale(dl_b->bw, cap) < dl_b->total_bw - old_bw + new_bw;
> + cap_scale(dl_b->bw, cap) < dl_b->total_bw - old_bw + new_bw
> + + cap_scale(dl_groups_root, cap);
> }
>
> static inline
> @@ -3147,10 +3154,16 @@ int sched_dl_global_validate(void)
> u64 period = global_rt_period();
> u64 new_bw = to_ratio(period, runtime);
> u64 cookie = ++dl_cookie;
> + u64 dl_groups_root = 0;
> struct dl_bw *dl_b;
> - int cpu, cpus, ret = 0;
> + int cpu, cap, cpus, ret = 0;
> unsigned long flags;
>
> +#ifdef CONFIG_RT_GROUP_SCHED
> + dl_groups_root = to_ratio(root_task_group.dl_bandwidth.dl_period,
> + root_task_group.dl_bandwidth.dl_runtime);
> +#endif
Can we move these ifdefs in some header and use helper functions
instead?
Thanks,
Juri