[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aWj6tJ8YQcu5B4hf@jlelli-thinkpadt14gen4.remote.csb>
Date: Thu, 15 Jan 2026 15:33:24 +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 03/28] sched/rt: Pass an rt_rq instead of an rq
where needed
Hello,
On 01/12/25 13:41, Yuri Andriaccio wrote:
> From: luca abeni <luca.abeni@...tannapisa.it>
>
> Make rt.c code access the runqueue through the rt_rq data structure rather
> than passing an rq pointer directly. This allows future patches to define
> rt_rq data structures which do not refer only to the global runqueue, but
> also to local cgroup runqueues (as rt_rq will not be always equal to
> &rq->rt).
>
> Add checks in rt_queue_{push/pull}_tasks to make sure that the given rt_rq
> object refers to a global runqueue and not any local one.
>
> Signed-off-by: luca abeni <luca.abeni@...tannapisa.it>
> Signed-off-by: Yuri Andriaccio <yurand2000@...il.com>
> ---
> kernel/sched/rt.c | 99 ++++++++++++++++++++++++++---------------------
> 1 file changed, 54 insertions(+), 45 deletions(-)
>
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 7936d43337..b7bf80a571 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -370,9 +370,9 @@ static inline void rt_clear_overload(struct rq *rq)
> cpumask_clear_cpu(rq->cpu, rq->rd->rto_mask);
> }
>
> -static inline int has_pushable_tasks(struct rq *rq)
> +static inline int has_pushable_tasks(struct rt_rq *rt_rq)
> {
> - return !plist_head_empty(&rq->rt.pushable_tasks);
> + return !plist_head_empty(&rt_rq->pushable_tasks);
> }
>
> static DEFINE_PER_CPU(struct balance_callback, rt_push_head);
> @@ -381,50 +381,54 @@ static DEFINE_PER_CPU(struct balance_callback, rt_pull_head);
> static void push_rt_tasks(struct rq *);
> static void pull_rt_task(struct rq *);
>
> -static inline void rt_queue_push_tasks(struct rq *rq)
> +static inline void rt_queue_push_tasks(struct rt_rq *rt_rq)
> {
> - if (!has_pushable_tasks(rq))
> + struct rq *rq = container_of(rt_rq, struct rq, rt);
Might be a minor thing, but I just noticed
https://elixir.bootlin.com/linux/v6.18-rc6/source/include/linux/container_of.h#L17
so, we might want to use container_of_const() here and below. Not that it
makes a difference for these cases, but the indication for new code seems
strict.
Peter, not sure if you have a preference here?
Thanks,
Juri
Powered by blists - more mailing lists