[Question] sched: rt.c: kernel-doc warning
From: Manuel Ebner
Date: Mon Oct 05 2026 - 03:32:34 EST
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