[PATCH] sched/rt: Fix not used variable 'max_rt_runtime'

From: Zeng Heng
Date: Fri Oct 25 2024 - 00:06:42 EST


Fix the following compilation warning:

kernel/sched/rt.c:9:18: warning: ‘max_rt_runtime’ defined but not used
[-Wunused-const-variable=]
9 | static const u64 max_rt_runtime = MAX_BW;

Only define the const variables when the CONFIG_SYSCTL or
CONFIG_RT_GROUP_SCHED is enabled.

Fixes: d505b8af5891 ("sched: Defend cfs and rt bandwidth quota against overflow")
Signed-off-by: Zeng Heng <zengheng4@xxxxxxxxxx>
---
kernel/sched/rt.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 172c588de542..0957f44b2eda 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -5,8 +5,10 @@
*/

int sched_rr_timeslice = RR_TIMESLICE;
+#if defined(CONFIG_SYSCTL) || defined(CONFIG_RT_GROUP_SCHED)
/* More than 4 hours if BW_SHIFT equals 20. */
static const u64 max_rt_runtime = MAX_BW;
+#endif

/*
* period over which we measure -rt task CPU usage in us.
--
2.25.1