[PATCH] sched/fair: Conditionally enable test_idle_cores() forward declaration

From: Anshuman Khandual
Date: Mon Mar 02 2020 - 23:30:45 EST


test_idle_cores()'s definition and all it's call sites are enclosed within
CONFIG_SCHED_SMT. Hence the forward declaration needs to be conditionally
enabled in order to prevent build warnings like the following.

kernel/sched/fair.c:1524:20: warning: âtest_idle_coresâ declared âstaticâ
but never defined [-Wunused-function]
static inline bool test_idle_cores(int cpu, bool def);
^~~~~~~~~~~~~~~

Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Juri Lelli <juri.lelli@xxxxxxxxxx>
Cc: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Cc: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Ben Segall <bsegall@xxxxxxxxxx>
Cc: Mel Gorman <mgorman@xxxxxxx>
Cc: sfr@xxxxxxxxxxxxxxxx
Cc: linux-next@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
---
This patch solves a build problem that exists on next-20200302.

kernel/sched/fair.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 84594f8..827087f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1521,7 +1521,9 @@ static inline bool is_core_idle(int cpu)
}

/* Forward declarations of select_idle_sibling helpers */
+#ifdef CONFIG_SCHED_SMT
static inline bool test_idle_cores(int cpu, bool def);
+#endif

struct task_numa_env {
struct task_struct *p;
--
2.7.4