[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241025034740.546570-1-xiqi2@huawei.com>
Date: Fri, 25 Oct 2024 11:47:40 +0800
From: Qi Xi <xiqi2@...wei.com>
To: <kernel@...neuler.org>, <bobo.shaobowang@...wei.com>, <xiqi2@...wei.com>,
<mingo@...hat.com>, <peterz@...radead.org>, <juri.lelli@...hat.com>,
<vincent.guittot@...aro.org>, <dietmar.eggemann@....com>,
<rostedt@...dmis.org>, <bsegall@...gle.com>, <mgorman@...e.de>,
<vschneid@...hat.com>, <patrick.bellasi@....com>, <mkoutny@...e.com>,
<tj@...nel.org>
CC: <linux-kernel@...r.kernel.org>
Subject: [PATCH] sched: Fix compile warning about variable 'uclamp_mutex'
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@...el.com>
Closes: https://lore.kernel.org/lkml/202410250459.EJe6PJI5-lkp@intel.com/
Signed-off-by: Qi Xi <xiqi2@...wei.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
Powered by blists - more mailing lists