[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aJ3sRfefZCxZd2t0@jlelli-thinkpadt14gen4.remote.csb>
Date: Thu, 14 Aug 2025 16:01:41 +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 13/25] sched/rt: Add HCBS related checks and
operations for rt tasks
Hi!
On 31/07/25 12:55, Yuri Andriaccio wrote:
> From: luca abeni <luca.abeni@...tannapisa.it>
>
> Add checks wheter a task belongs to the root cgroup or a rt-cgroup, since HCBS
> reuses the rt classes' scheduler, and operate accordingly where needed.
>
> 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>
> ---
> kernel/sched/core.c | 3 +
> kernel/sched/deadline.c | 16 ++++-
> kernel/sched/rt.c | 147 +++++++++++++++++++++++++++++++++++++---
> kernel/sched/sched.h | 6 +-
> kernel/sched/syscalls.c | 13 ++++
> 5 files changed, 171 insertions(+), 14 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 3a69cb906c3..6173684a02b 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2196,6 +2196,9 @@ void wakeup_preempt(struct rq *rq, struct task_struct *p, int flags)
> {
> struct task_struct *donor = rq->donor;
>
> + if (is_dl_group(rt_rq_of_se(&p->rt)) && task_has_rt_policy(p))
> + resched_curr(rq);
Why this unconditional resched for tasks in groups?
...
> @@ -715,6 +744,14 @@ enqueue_task_rt(struct rq *rq, struct task_struct *p, int flags)
> check_schedstat_required();
> update_stats_wait_start_rt(rt_rq_of_se(rt_se), rt_se);
>
> + /* Task arriving in an idle group of tasks. */
> + if (IS_ENABLED(CONFIG_RT_GROUP_SCHED) &&
> + is_dl_group(rt_rq) && rt_rq->rt_nr_running == 0) {
> + struct sched_dl_entity *dl_se = dl_group_of(rt_rq);
> +
> + dl_server_start(dl_se);
> + }
> +
> enqueue_rt_entity(rt_se, flags);
Is it OK to start the server before the first task is enqueued in an
idle group?
...
> @@ -891,6 +936,34 @@ static void wakeup_preempt_rt(struct rq *rq, struct task_struct *p, int flags)
> {
> struct task_struct *donor = rq->donor;
>
> + if (!rt_group_sched_enabled())
> + goto no_group_sched;
> +
I think the below deserves a comment detailing the rules of preemption
(inside/outside groups, etc.).
> + if (is_dl_group(rt_rq_of_se(&p->rt)) &&
> + is_dl_group(rt_rq_of_se(&rq->curr->rt))) {
> + struct sched_dl_entity *dl_se, *curr_dl_se;
> +
> + dl_se = dl_group_of(rt_rq_of_se(&p->rt));
> + curr_dl_se = dl_group_of(rt_rq_of_se(&rq->curr->rt));
> +
> + if (dl_entity_preempt(dl_se, curr_dl_se)) {
> + resched_curr(rq);
> + return;
> + } else if (!dl_entity_preempt(curr_dl_se, dl_se)) {
Isn't this condition implied by the above?
...
> +#ifdef CONFIG_RT_GROUP_SCHED
> +static int group_push_rt_task(struct rt_rq *rt_rq)
> +{
> + struct rq *rq = rq_of_rt_rq(rt_rq);
> +
> + if (is_dl_group(rt_rq))
> + return 0;
> +
> + return push_rt_task(rq, false);
> +}
> +
> +static void group_push_rt_tasks(struct rt_rq *rt_rq)
> +{
> + while (group_push_rt_task(rt_rq))
> + ;
> +}
> +#else
> +static void group_push_rt_tasks(struct rt_rq *rt_rq)
> +{
> + push_rt_tasks(rq_of_rt_rq(rt_rq));
> +}
> +#endif
> +
Hummm, maybe too much for a single patch? I am a little lost at this
point. :))
Thanks,
Juri
Powered by blists - more mailing lists