[PATCH] sched/core: u_clamp: Fix "-Wunused-function" warnings

From: WangYuli
Date: Tue Mar 11 2025 - 05:08:07 EST


Given that uclamp_update_active() is exclusively called by
uclamp_update_active_tasks(), and considering that
uclamp_update_active_tasks() is utilized solely when
CONFIG_UCLAMP_TASK_GROUP is enabled, it follows that
uclamp_update_active() will emit a compilation warning if
CONFIG_UCLAMP_TASK_GROUP is not enabled.

Similar reason of uclamp_rq_reinc_id().

Fix follow errors with clang-19 when W=1e:

kernel/sched/core.c:1818:1: error: unused function 'uclamp_update_active' [-Werror,-Wunused-function]
1818 | uclamp_update_active(struct task_struct *p)
| ^~~~~~~~~~~~~~~~~~~~

kernel/sched/core.c:1800:20: error: unused function 'uclamp_rq_reinc_id' [-Werror,-Wunused-function]
1800 | static inline void uclamp_rq_reinc_id(struct rq *rq, struct task_struct *p,
| ^~~~~~~~~~~~~~~~~~

Signed-off-by: WangYuli <wangyuli@xxxxxxxxxxxxx>
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 67189907214d..49549e030f4c 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1797,6 +1797,7 @@ static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p)
uclamp_rq_dec_id(rq, p, clamp_id);
}

+#ifdef CONFIG_UCLAMP_TASK_GROUP
static inline void uclamp_rq_reinc_id(struct rq *rq, struct task_struct *p,
enum uclamp_id clamp_id)
{
@@ -1843,7 +1844,6 @@ uclamp_update_active(struct task_struct *p)
task_rq_unlock(rq, p, &rf);
}

-#ifdef CONFIG_UCLAMP_TASK_GROUP
static inline void
uclamp_update_active_tasks(struct cgroup_subsys_state *css)
{
--
2.47.2