Re: [RFC PATCH v3 08/24] sched/deadline: Add dl_init_tg
From: Juri Lelli
Date: Wed Oct 08 2025 - 02:25:36 EST
Hello,
On 29/09/25 11:22, Yuri Andriaccio wrote:
> From: luca abeni <luca.abeni@xxxxxxxxxxxxxxx>
>
> Add dl_init_tg to initialize and/or update a rt-cgroup dl_server and to
> also account the allocated bandwidth.
>
> 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 | 33 +++++++++++++++++++++++++++++++++
> kernel/sched/sched.h | 1 +
> 2 files changed, 34 insertions(+)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 5c8fe80b585..34a1494d782 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -340,6 +340,39 @@ void cancel_inactive_timer(struct sched_dl_entity *dl_se)
> cancel_dl_timer(dl_se, &dl_se->inactive_timer);
> }
>
> +#ifdef CONFIG_RT_GROUP_SCHED
> +void dl_init_tg(struct sched_dl_entity *dl_se, u64 rt_runtime, u64 rt_period)
This is not called from anywhere at this point, is it? I wonder if we
want to introduce dead code for later usage or if it would make more
sense to introduce it together with the calling sites.
> +{
> + struct rq *rq = container_of(dl_se->dl_rq, struct rq, dl);
> + int is_active;
> + u64 new_bw;
> +
> + raw_spin_rq_lock_irq(rq);
> + is_active = dl_se->my_q->rt.rt_nr_running > 0;
> +
> + update_rq_clock(rq);
> + dl_server_stop(dl_se);
> +
> + new_bw = to_ratio(dl_se->dl_period, dl_se->dl_runtime);
Is this correct? Not sure yet where/how dl_init_tg() is called, but
don't we want to compute new_bw using rt_runtime and rt_period?
Thanks,
Juri