[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aJ3y4YfcVQ-qVrxF@jlelli-thinkpadt14gen4.remote.csb>
Date: Thu, 14 Aug 2025 16:29:53 +0200
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 v2 19/25] sched/deadline: Allow deeper hierarchies of
RT cgroups
Hi!
On 31/07/25 12:55, Yuri Andriaccio wrote:
...
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 7b131630743..e263abcdc04 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -406,11 +406,42 @@ int dl_check_tg(unsigned long total)
> return 1;
> }
>
> -void dl_init_tg(struct sched_dl_entity *dl_se, u64 rt_runtime, u64 rt_period)
> +static inline bool is_active_sched_group(struct task_group *tg)
> {
> + struct task_group *child;
> + bool is_active = 1;
> +
> + // if there are no children, this is a leaf group, thus it is active
> + list_for_each_entry_rcu(child, &tg->children, siblings) {
> + if (child->dl_bandwidth.dl_runtime > 0) {
> + is_active = 0;
> + }
> + }
> + return is_active;
> +}
> +
> +static inline bool sched_group_has_active_siblings(struct task_group *tg)
> +{
> + struct task_group *child;
> + bool has_active_siblings = 0;
> +
> + // if there are no children, this is a leaf group, thus it is active
> + list_for_each_entry_rcu(child, &tg->parent->children, siblings) {
> + if (child != tg && child->dl_bandwidth.dl_runtime > 0) {
> + has_active_siblings = 1;
> + }
> + }
> + return has_active_siblings;
> +}
...
> @@ -2216,7 +2228,14 @@ int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
> if (rt_group_sched_enabled() && tg->dl_bandwidth.dl_runtime == 0)
> return 0;
>
> - return 1;
> + /* If one of the children has runtime > 0, cannot attach RT tasks! */
> + list_for_each_entry_rcu(child, &tg->children, siblings) {
> + if (child->dl_bandwidth.dl_runtime) {
> + can_attach = 0;
> + }
> + }
Can we maybe reuse some of the methods above?
Thanks,
Juri
Powered by blists - more mailing lists