All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: Fix compile warning about variable 'uclamp_mutex'
@ 2024-10-25  3:47 Qi Xi
  2024-10-25  7:32 ` Peter Zijlstra
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Qi Xi @ 2024-10-25  3:47 UTC (permalink / raw)
  To: kernel, bobo.shaobowang, xiqi2, mingo, peterz, juri.lelli,
	vincent.guittot, dietmar.eggemann, rostedt, bsegall, mgorman,
	vschneid, patrick.bellasi, mkoutny, tj
  Cc: linux-kernel

When build with CONFIG_UCLAMP_TASK && !CONFIG_UCLAMP_TASK_GROUP,
the variable 'uclamp_mutex' is defined but not used:

kernel/sched/core.c:1361:21: warning: 'uclamp_mutex' defined but not used [-Wunused-variable]
    1361 | static DEFINE_MUTEX(uclamp_mutex);

Fix this by only defining the variable uclamp_mutex when the
CONFIG_UCLAMP_TASK_GROUP is enabled.

Fixes: 2480c093130f ("sched/uclamp: Extend CPU's cgroup controller")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/lkml/202410250459.EJe6PJI5-lkp@intel.com/
Signed-off-by: Qi Xi <xiqi2@huawei.com>
---
 kernel/sched/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f3951e4a55e5..9109fed6f022 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1348,6 +1348,7 @@ void set_load_weight(struct task_struct *p, bool update_load)
 }
 
 #ifdef CONFIG_UCLAMP_TASK
+#ifdef CONFIG_UCLAMP_TASK_GROUP
 /*
  * Serializes updates of utilization clamp values
  *
@@ -1359,6 +1360,7 @@ void set_load_weight(struct task_struct *p, bool update_load)
  * updates or API abuses.
  */
 static DEFINE_MUTEX(uclamp_mutex);
+#endif /* CONFIG_UCLAMP_TASK_GROUP */
 
 /* Max allowed minimum utilization */
 static unsigned int __maybe_unused sysctl_sched_uclamp_util_min = SCHED_CAPACITY_SCALE;
-- 
2.33.0


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

end of thread, other threads:[~2024-10-25 22:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-25  3:47 [PATCH] sched: Fix compile warning about variable 'uclamp_mutex' Qi Xi
2024-10-25  7:32 ` Peter Zijlstra
2024-10-25 22:08 ` kernel test robot
2024-10-25 22:19 ` kernel test robot

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.