The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Yajun Deng <yajun.deng@linux.dev>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com
Cc: linux-kernel@vger.kernel.org, Yajun Deng <yajun.deng@linux.dev>
Subject: [PATCH] sched/rt: Remove the unnecessary CONFIG_RT_GROUP_SCHED
Date: Wed, 29 Oct 2025 11:37:36 +0800	[thread overview]
Message-ID: <20251029033736.85509-1-yajun.deng@linux.dev> (raw)

After commit 5f6bd380c7bd ("sched/rt: Remove default bandwidth control"),
these bandwidth control members are only initialized when
CONFIG_RT_GROUP_SCHED is enabled.

Remove the unnecessary CONFIG_RT_GROUP_SCHED from init_rt_rq() and
initialize the members in init_tg_rt_entry().

init_rt_bandwidth() is called in sched_init(). The rt_runtime of
rt_bandwidth is initialized by global_rt_runtime(), Therefore, we can set
the rt_runtime of rt_rq by the rt_runtime of rt_bandwidth in
init_tg_rt_entry().

Also, remove the unnecessary CONFIG_RT_GROUP_SCHED in rt_se_prio().

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 kernel/sched/core.c |  6 ------
 kernel/sched/rt.c   | 17 +++++------------
 2 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 1842285eac1e..76b6c7b15604 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8645,12 +8645,6 @@ void __init sched_init(void)
 #endif /* CONFIG_FAIR_GROUP_SCHED */
 
 #ifdef CONFIG_RT_GROUP_SCHED
-		/*
-		 * This is required for init cpu because rt.c:__enable_runtime()
-		 * starts working after scheduler_running, which is not the case
-		 * yet.
-		 */
-		rq->rt.rt_runtime = global_rt_runtime();
 		init_tg_rt_entry(&root_task_group, &rq->rt, NULL, i, NULL);
 #endif
 		rq->sd = NULL;
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 1fd97f2d7ec6..a7b27f80f3a0 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -84,14 +84,6 @@ void init_rt_rq(struct rt_rq *rt_rq)
 	plist_head_init(&rt_rq->pushable_tasks);
 	/* We start is dequeued state, because no RT tasks are queued */
 	rt_rq->rt_queued = 0;
-
-#ifdef CONFIG_RT_GROUP_SCHED
-	rt_rq->rt_time = 0;
-	rt_rq->rt_throttled = 0;
-	rt_rq->rt_runtime = 0;
-	raw_spin_lock_init(&rt_rq->rt_runtime_lock);
-	rt_rq->tg = &root_task_group;
-#endif
 }
 
 #ifdef CONFIG_RT_GROUP_SCHED
@@ -229,10 +221,14 @@ void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq,
 {
 	struct rq *rq = cpu_rq(cpu);
 
-	rt_rq->highest_prio.curr = MAX_RT_PRIO-1;
+	rt_rq->rt_time = 0;
+	rt_rq->rt_throttled = 0;
 	rt_rq->rt_nr_boosted = 0;
+	raw_spin_lock_init(&rt_rq->rt_runtime_lock);
+
 	rt_rq->rq = rq;
 	rt_rq->tg = tg;
+	rt_rq->rt_runtime = tg->rt_bandwidth.rt_runtime;
 
 	tg->rt_rq[cpu] = rt_rq;
 	tg->rt_se[cpu] = rt_se;
@@ -280,7 +276,6 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
 			goto err_free_rq;
 
 		init_rt_rq(rt_rq);
-		rt_rq->rt_runtime = tg->rt_bandwidth.rt_runtime;
 		init_tg_rt_entry(tg, rt_rq, rt_se, i, parent->rt_se[i]);
 	}
 
@@ -957,12 +952,10 @@ static void __disable_runtime(struct rq *rq) { }
 
 static inline int rt_se_prio(struct sched_rt_entity *rt_se)
 {
-#ifdef CONFIG_RT_GROUP_SCHED
 	struct rt_rq *rt_rq = group_rt_rq(rt_se);
 
 	if (rt_rq)
 		return rt_rq->highest_prio.curr;
-#endif
 
 	return rt_task_of(rt_se)->prio;
 }
-- 
2.25.1


             reply	other threads:[~2025-10-29  3:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-29  3:37 Yajun Deng [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-08-18  6:17 [PATCH] sched/rt: Remove the unnecessary CONFIG_RT_GROUP_SCHED Yajun Deng
2025-08-26  1:45 ` Yajun Deng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251029033736.85509-1-yajun.deng@linux.dev \
    --to=yajun.deng@linux.dev \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox