[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aW42WpMMfHViDOzo@jlelli-thinkpadt14gen4.remote.csb>
Date: Mon, 19 Jan 2026 14:49:14 +0100
From: Juri Lelli <juri.lelli@...hat.com>
To: Yuri Andriaccio <yurand2000@...il.com>
Cc: Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Valentin Schneider <vschneid@...hat.com>,
linux-kernel@...r.kernel.org,
Luca Abeni <luca.abeni@...tannapisa.it>,
Yuri Andriaccio <yuri.andriaccio@...tannapisa.it>
Subject: Re: [RFC PATCH v4 10/28] sched/rt: Add {alloc/free}_rt_sched_group
Hello,
On 01/12/25 13:41, Yuri Andriaccio wrote:
> From: luca abeni <luca.abeni@...tannapisa.it>
>
> - Add allocation and deallocation code for rt-cgroups.
> - Declare dl_server specific functions (only skeleton, but no
> implementation yet), needed by the deadline servers to be called when
> trying to schedule.
>
> Co-developed-by: Alessio Balsini <a.balsini@...up.it>
> Signed-off-by: Alessio Balsini <a.balsini@...up.it>
> Co-developed-by: Andrea Parri <parri.andrea@...il.com>
> Signed-off-by: Andrea Parri <parri.andrea@...il.com>
> Co-developed-by: Yuri Andriaccio <yurand2000@...il.com>
> Signed-off-by: Yuri Andriaccio <yurand2000@...il.com>
> Signed-off-by: luca abeni <luca.abeni@...tannapisa.it>
> ---
...
> +static inline void __dl_se_free(struct sched_dl_entity **dl_se)
> +{
> + int i;
> +
> + for_each_possible_cpu(i) {
> + kfree(dl_se[i]);
> + }
> +
> + kfree(dl_se);
> }
>
> +DEFINE_FREE(dl_se_free, struct sched_dl_entity **, if (_T) __dl_se_free(_T))
> +
> int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
> {
> + /* Instantiate automatic cleanup in event of kalloc fail */
> + struct rt_rq **tg_rt_rq __free(rt_rq_free) = NULL;
> + struct sched_dl_entity *dl_se, **tg_dl_se __free(dl_se_free) = NULL;
> + struct rq *s_rq;
> + int i;
> +
> if (!rt_group_sched_enabled())
> return 1;
>
> + /* Allocate all necessary resources beforehand */
> + tg_rt_rq = kcalloc(nr_cpu_ids, sizeof(struct rt_rq *), GFP_KERNEL);
> + if (!tg_rt_rq)
> + return 0;
> +
> + tg_dl_se = kcalloc(nr_cpu_ids,
> + sizeof(struct sched_dl_entity *), GFP_KERNEL);
> + if (!tg_dl_se)
> + return 0;
> +
> + for_each_possible_cpu(i) {
> + s_rq = kzalloc_node(sizeof(struct rq),
> + GFP_KERNEL, cpu_to_node(i));
> + if (!s_rq)
> + return 0;
> +
> + dl_se = kzalloc_node(sizeof(struct sched_dl_entity),
> + GFP_KERNEL, cpu_to_node(i));
> + if (!dl_se) {
> + kfree(s_rq);
> + return 0;
> + }
Would it be possible and make sense to use the __free() approach in the
above two cases as well?
Thanks,
Juri
Powered by blists - more mailing lists