[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250409122314.2848028-5-arnd@kernel.org>
Date: Wed, 9 Apr 2025 14:22:57 +0200
From: Arnd Bergmann <arnd@...nel.org>
To: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Nathan Chancellor <nathan@...nel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Arnd Bergmann <arnd@...db.de>,
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>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
"Connor O'Brien" <connoro@...gle.com>,
Joel Granados <joel.granados@...nel.org>,
linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: [PATCH 05/10] [RESEND] sched: open-code max_rt_runtime definition
From: Arnd Bergmann <arnd@...db.de>
Building with clang using "make W=1" normally produces warnings about unused
const variables, but clang does not warn about those in header files.
In case of rt.c it also doesn't warn because this gets included by
from build_policy.c.
Enabling the same warning on gcc also warns about it in included files,
so we end up with a warning when all users of max_rt_runtime are
hidden because both CONFIG_RT_GROUP_SCHED and CONFIG_SYSCTL are
disabled:
kernel/sched/rt.c:9:18: error: 'max_rt_runtime' defined but not used [-Werror=unused-const-variable]
It's not possible to avoid the warning by moving max_rt_runtime
into one of the #ifdef sections, but since it is itself defined
as MAX_BW, simply open-coding that is an easy workaround.
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
kernel/sched/rt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index fa03ec3ed56a..89edb24e63ea 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -5,8 +5,6 @@
*/
int sched_rr_timeslice = RR_TIMESLICE;
-/* More than 4 hours if BW_SHIFT equals 20. */
-static const u64 max_rt_runtime = MAX_BW;
/*
* period over which we measure -rt task CPU usage in us.
@@ -2778,7 +2776,7 @@ static int tg_set_rt_bandwidth(struct task_group *tg,
/*
* Bound quota to defend quota against overflow during bandwidth shift.
*/
- if (rt_runtime != RUNTIME_INF && rt_runtime > max_rt_runtime)
+ if (rt_runtime != RUNTIME_INF && rt_runtime > MAX_BW)
return -EINVAL;
mutex_lock(&rt_constraints_mutex);
@@ -2890,7 +2888,7 @@ static int sched_rt_global_validate(void)
if ((sysctl_sched_rt_runtime != RUNTIME_INF) &&
((sysctl_sched_rt_runtime > sysctl_sched_rt_period) ||
((u64)sysctl_sched_rt_runtime *
- NSEC_PER_USEC > max_rt_runtime)))
+ NSEC_PER_USEC > MAX_BW)))
return -EINVAL;
return 0;
--
2.39.5
Powered by blists - more mailing lists