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

From: Vincent Guittot
Date: Tue Mar 03 2020 - 03:10:18 EST


Hi Anshuman,

On Tue, 3 Mar 2020 at 05:30, Anshuman Khandual
<anshuman.khandual@xxxxxxx> wrote:
>
> 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);
> ^~~~~~~~~~~~~~~

similar patches has already been sent:
https://lore.kernel.org/lkml/20200226121244.7524-1-valentin.schneider@xxxxxxx/
https://lore.kernel.org/patchwork/patch/1201059/

>
> 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
>