All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Nathan Chancellor <nathan@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Arnd Bergmann <arnd@arndb.de>,
	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>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	"Connor O'Brien" <connoro@google.com>,
	Joel Granados <joel.granados@kernel.org>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH 05/10] [RESEND] sched: open-code max_rt_runtime definition
Date: Wed,  9 Apr 2025 14:22:57 +0200	[thread overview]
Message-ID: <20250409122314.2848028-5-arnd@kernel.org> (raw)
In-Reply-To: <20250409122314.2848028-1-arnd@kernel.org>

From: Arnd Bergmann <arnd@arndb.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@arndb.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


  parent reply	other threads:[~2025-04-09 12:23 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09 12:21 [PATCH 00/10] -Wunused-const-variable warning fixes Arnd Bergmann
2025-04-09 12:22 ` [PATCH 01/10] drm/imagination: avoid unused-const-variable warning Arnd Bergmann
2025-04-09 12:22   ` [PATCH 02/10] [v2] clocksource: atmel_tcb: fix kconfig dependency Arnd Bergmann
2025-04-09 12:47     ` Alexandre Belloni
2025-04-09 15:30     ` Andy Shevchenko
2025-04-09 15:53       ` Arnd Bergmann
2025-04-09 12:22   ` [PATCH 03/10] [v2] Input: stmpe-ts - use module alias instead of device table Arnd Bergmann
2025-04-09 15:33     ` Andy Shevchenko
2025-04-09 15:49       ` Krzysztof Kozlowski
2025-04-09 12:22   ` [PATCH 04/10] [RESEND] mux: adg792a: remove incorrect of_match_ptr annotation Arnd Bergmann
2025-04-09 15:34     ` Andy Shevchenko
2025-05-01 17:56     ` (subset) " Krzysztof Kozlowski
2025-04-09 12:22   ` Arnd Bergmann [this message]
2025-04-09 12:22   ` [PATCH 06/10] [RESEND] lockdep: change 'static const' variables to enum values Arnd Bergmann
2025-05-02 14:02     ` Andy Shevchenko
2025-07-11 22:13       ` Boqun Feng
2025-07-19 17:40     ` [tip: locking/core] locking/lockdep: Change " tip-bot2 for Arnd Bergmann
2025-04-09 12:22   ` [PATCH 07/10] [RESEND] ARM: fixmap: make __end_of_early_ioremap_region an enum value Arnd Bergmann
2025-04-09 16:54     ` Andy Shevchenko
2025-04-09 12:23   ` [PATCH 08/10] [RESEND 2] comedi: ni_atmio: avoid warning for unused device_ids[] table Arnd Bergmann
2025-04-09 12:23   ` [PATCH 09/10] [RESEND 2] apm-emulation: hide an unused variable Arnd Bergmann
2025-04-10 11:22   ` [PATCH 01/10] drm/imagination: avoid unused-const-variable warning Matt Coster
2025-04-10 11:56     ` Jani Nikula
2025-04-10 11:58     ` Arnd Bergmann
2025-04-14  6:51     ` Andy Shevchenko
2025-04-22 16:08   ` Matt Coster
2025-04-24 10:04   ` (subset) " Matt Coster
2025-04-09 12:24 ` [PATCH 10/10] [RESEND 3] dma/contiguous: avoid warning about unused size_bytes Arnd Bergmann
2025-04-09 14:35   ` Marek Szyprowski
2025-04-09 14:43     ` Andy Shevchenko
2025-04-09 14:51       ` Arnd Bergmann
2025-04-09 14:57         ` Marek Szyprowski

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=20250409122314.2848028-5-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=bsegall@google.com \
    --cc=connoro@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=joel.granados@kernel.org \
    --cc=juri.lelli@redhat.com \
    --cc=justinstitt@google.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.