mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qi Xi <xiqi2@huawei.com>
To: <kernel@openeuler.org>, <bobo.shaobowang@huawei.com>,
	<xiqi2@huawei.com>, <mingo@redhat.com>, <peterz@infradead.org>,
	<juri.lelli@redhat.com>, <vincent.guittot@linaro.org>,
	<dietmar.eggemann@arm.com>, <rostedt@goodmis.org>,
	<bsegall@google.com>, <mgorman@suse.de>, <vschneid@redhat.com>,
	<patrick.bellasi@arm.com>, <mkoutny@suse.com>, <tj@kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH] sched: Fix compile warning about variable 'uclamp_mutex'
Date: Fri, 25 Oct 2024 11:47:40 +0800	[thread overview]
Message-ID: <20241025034740.546570-1-xiqi2@huawei.com> (raw)

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


             reply	other threads:[~2024-10-25  3:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-25  3:47 Qi Xi [this message]
2024-10-25  7:32 ` Peter Zijlstra
2024-10-25 22:08 ` kernel test robot
2024-10-25 22:19 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241025034740.546570-1-xiqi2@huawei.com \
    --to=xiqi2@huawei.com \
    --cc=bobo.shaobowang@huawei.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kernel@openeuler.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=patrick.bellasi@arm.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®