mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [Question] sched: rt.c: kernel-doc warning
@ 2026-10-05  7:27 Manuel Ebner
  2026-10-12  9:45 ` K Prateek Nayak
  0 siblings, 1 reply; 2+ messages in thread
From: Manuel Ebner @ 2026-10-05  7:27 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, K Prateek Nayak
  Cc: Manuel Ebner, linux-kernel

Hi,

I'm trying to fix built warning and stumbled over this one:

$make W=1 -j8 > make_output.txt
In file included from kernel/sched/build_policy.c:52:
kernel/sched/rt.c:12:18: warning: ‘max_rt_runtime’ defined but not used [-Wunused-const-variable=]
   12 | static const u64 max_rt_runtime = MAX_BW;
      |                  ^~~~~~~~~~~~~~

I just can't make sense of this, because max_rt_runtime is used later in the
file - see diff.
What am I missing?

Thanks
 Manuel Ebner
---
 kernel/sched/rt.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 1535046a2..4d15f5c47 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -10,6 +10,14 @@
 int sched_rr_timeslice = RR_TIMESLICE;
 /* More than 4 hours if BW_SHIFT equals 20. */
 static const u64 max_rt_runtime = MAX_BW;
+/* When I build a tinyconfig this warning is triggered
+ *
+ * $make W=1 -j8 > make_output.txt
+ * In file included from kernel/sched/build_policy.c:52:
+ * kernel/sched/rt.c:12:18: warning: ‘max_rt_runtime’ defined but not used [-Wunused-const-variable=]
+ *   12 | static const u64 max_rt_runtime = MAX_BW;
+ *      |                  ^~~~~~~~~~~~~~
+ */
 
 /*
  * period over which we measure -rt task CPU usage in us.
@@ -2766,6 +2774,9 @@ 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)
+/* 
+ * here max_rt_runtime is obviosly used
+ */
 		return -EINVAL;
 
 	mutex_lock(&rt_constraints_mutex);
@@ -2857,6 +2868,9 @@ static int sched_rt_global_validate(void)
 		((sysctl_sched_rt_runtime > sysctl_sched_rt_period) ||
 		 ((u64)sysctl_sched_rt_runtime *
 			NSEC_PER_USEC > max_rt_runtime)))
+/*
+ * here it is used again
+ */
 		return -EINVAL;
 
 #ifdef CONFIG_RT_GROUP_SCHED
-- 
2.55.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Question] sched: rt.c: kernel-doc warning
  2026-10-05  7:27 [Question] sched: rt.c: kernel-doc warning Manuel Ebner
@ 2026-10-12  9:45 ` K Prateek Nayak
  0 siblings, 0 replies; 2+ messages in thread
From: K Prateek Nayak @ 2026-10-12  9:45 UTC (permalink / raw)
  To: Manuel Ebner, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Valentin Schneider
  Cc: linux-kernel

Hello Manuel,

On 10/5/2026 12:57 PM, Manuel Ebner wrote:
> [You don't often get email from manuelebnerli@mailbox.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> Hi,
> 
> I'm trying to fix built warning and stumbled over this one:
> 
> $make W=1 -j8 > make_output.txt
> In file included from kernel/sched/build_policy.c:52:
> kernel/sched/rt.c:12:18: warning: ‘max_rt_runtime’ defined but not used [-Wunused-const-variable=]
>    12 | static const u64 max_rt_runtime = MAX_BW;
>       |                  ^~~~~~~~~~~~~~
> 
> I just can't make sense of this, because max_rt_runtime is used later in the
> file - see diff.
> What am I missing?

Any chance you have both CONFIG_RT_GROUP_SCHED and CONFIG_SYSCTL
disabled in your .config?

In that case, max_rt_runtime is never used by anything that gets
built in and the compiler complains. You can annotate it with
__maybe_unused to keep the build happy in those cases.

-- 
Thanks and Regards,
Prateek


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-12  9:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-05  7:27 [Question] sched: rt.c: kernel-doc warning Manuel Ebner
2026-10-12  9:45 ` K Prateek Nayak

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®