mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michal Koutný" <mkoutny@suse.com>
To: Peter Zijlstra <peterz@infradead.org>,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Ingo Molnar" <mingo@redhat.com>,
	"Juri Lelli" <juri.lelli@redhat.com>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Ben Segall" <bsegall@google.com>, "Mel Gorman" <mgorman@suse.de>,
	"Valentin Schneider" <vschneid@redhat.com>,
	"Frederic Weisbecker" <fweisbecker@suse.com>,
	"Michal Koutný" <mkoutny@suse.com>
Subject: [PATCH v2 01/10] sched: Convert CONFIG_RT_GROUP_SCHED macros to code conditions
Date: Mon, 10 Mar 2025 18:04:33 +0100	[thread overview]
Message-ID: <20250310170442.504716-2-mkoutny@suse.com> (raw)
In-Reply-To: <20250310170442.504716-1-mkoutny@suse.com>

Convert the blocks guarded by macros to regular code so that the RT
group code gets more compile validation. Reasoning is in
Documentation/process/coding-style.rst 21) Conditional Compilation.
With that, no functional change is expected.

Signed-off-by: Michal Koutný <mkoutny@suse.com>
---
 kernel/sched/rt.c       | 10 ++++------
 kernel/sched/syscalls.c |  2 +-
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 4b8e33c615b12..3116745be304b 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1068,13 +1068,12 @@ inc_rt_prio_smp(struct rt_rq *rt_rq, int prio, int prev_prio)
 {
 	struct rq *rq = rq_of_rt_rq(rt_rq);
 
-#ifdef CONFIG_RT_GROUP_SCHED
 	/*
 	 * Change rq's cpupri only if rt_rq is the top queue.
 	 */
-	if (&rq->rt != rt_rq)
+	if (IS_ENABLED(CONFIG_RT_GROUP_SCHED) && &rq->rt != rt_rq)
 		return;
-#endif
+
 	if (rq->online && prio < prev_prio)
 		cpupri_set(&rq->rd->cpupri, rq->cpu, prio);
 }
@@ -1084,13 +1083,12 @@ dec_rt_prio_smp(struct rt_rq *rt_rq, int prio, int prev_prio)
 {
 	struct rq *rq = rq_of_rt_rq(rt_rq);
 
-#ifdef CONFIG_RT_GROUP_SCHED
 	/*
 	 * Change rq's cpupri only if rt_rq is the top queue.
 	 */
-	if (&rq->rt != rt_rq)
+	if (IS_ENABLED(CONFIG_RT_GROUP_SCHED) && &rq->rt != rt_rq)
 		return;
-#endif
+
 	if (rq->online && rt_rq->highest_prio.curr != prev_prio)
 		cpupri_set(&rq->rd->cpupri, rq->cpu, rt_rq->highest_prio.curr);
 }
diff --git a/kernel/sched/syscalls.c b/kernel/sched/syscalls.c
index 456d339be98fb..8629a87628ebf 100644
--- a/kernel/sched/syscalls.c
+++ b/kernel/sched/syscalls.c
@@ -640,7 +640,7 @@ int __sched_setscheduler(struct task_struct *p,
 			retval = -EPERM;
 			goto unlock;
 		}
-#endif
+#endif /* CONFIG_RT_GROUP_SCHED */
 #ifdef CONFIG_SMP
 		if (dl_bandwidth_enabled() && dl_policy(policy) &&
 				!(attr->sched_flags & SCHED_FLAG_SUGOV)) {
-- 
2.48.1


  reply	other threads:[~2025-03-10 17:05 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10 17:04 [PATCH v2 00/10] Add kernel cmdline option for rt_group_sched Michal Koutný
2025-03-10 17:04 ` Michal Koutný [this message]
2025-04-08 19:05   ` [tip: sched/core] sched: Convert CONFIG_RT_GROUP_SCHED macros to code conditions tip-bot2 for Michal Koutný
2025-03-10 17:04 ` [PATCH v2 02/10] sched: Remove unneeed macro wrap Michal Koutný
2025-04-08 19:05   ` [tip: sched/core] " tip-bot2 for Michal Koutný
2025-03-10 17:04 ` [PATCH v2 03/10] sched: Always initialize rt_rq's task_group Michal Koutný
2025-04-08 19:05   ` [tip: sched/core] " tip-bot2 for Michal Koutný
2025-03-10 17:04 ` [PATCH v2 04/10] sched: Add commadline option for RT_GROUP_SCHED toggling Michal Koutný
2025-04-08 19:05   ` [tip: sched/core] " tip-bot2 for Michal Koutný
2025-03-10 17:04 ` [PATCH v2 05/10] sched: Skip non-root task_groups with disabled RT_GROUP_SCHED Michal Koutný
2025-04-08 19:05   ` [tip: sched/core] " tip-bot2 for Michal Koutný
2025-03-10 17:04 ` [PATCH v2 06/10] sched: Bypass bandwitdh checks with runtime " Michal Koutný
2025-04-02 12:02   ` Peter Zijlstra
2025-04-03 12:20     ` Michal Koutný
2025-04-08 19:05   ` [tip: sched/core] " tip-bot2 for Michal Koutný
2025-03-10 17:04 ` [PATCH v2 07/10] sched: Do not construct nor expose RT_GROUP_SCHED structures if disabled Michal Koutný
2025-04-08 19:05   ` [tip: sched/core] " tip-bot2 for Michal Koutný
2025-03-10 17:04 ` [PATCH v2 08/10] sched: Add RT_GROUP WARN checks for non-root task_groups Michal Koutný
2025-04-08 19:05   ` [tip: sched/core] " tip-bot2 for Michal Koutný
2025-03-10 17:04 ` [PATCH v2 09/10] sched: Add annotations to RT_GROUP_SCHED fields Michal Koutný
2025-04-08 19:05   ` [tip: sched/core] " tip-bot2 for Michal Koutný
2025-03-10 17:04 ` [PATCH v2 10/10] sched: Add deprecation warning for users of RT_GROUP_SCHED Michal Koutný
2025-04-17 12:13   ` Michal Koutný
2025-05-02 14:48     ` Michal Koutný
2025-03-24 18:10 ` [PATCH v2 00/10] Add kernel cmdline option for rt_group_sched Michal Koutný
2025-04-01 11:05 ` Peter Zijlstra
2025-04-03 12:17   ` Michal Koutný
2025-04-07  5:57     ` Juri Lelli

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=20250310170442.504716-2-mkoutny@suse.com \
    --to=mkoutny@suse.com \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=fweisbecker@suse.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

all inboxes | Powered by JetHome®