linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Fix kernel build warning in test_idle_cores() for !SMT NUMA
@ 2020-02-27 14:02 Mel Gorman
  2020-02-28 10:02 ` Lukasz Luba
  2020-03-03 10:08 ` Valentin Schneider
  0 siblings, 2 replies; 7+ messages in thread
From: Mel Gorman @ 2020-02-27 14:02 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Peter Zijlstra, Vincent Guittot, Juri Lelli, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Valentin Schneider, Phil Auld,
	Hillf Danton, LKML, Lukasz Luba

Building against tip/sched/core as of as ff7db0bf24db ("sched/numa: Prefer
using an idle CPU as a migration target instead of comparing tasks") with
the arm64 defconfig (which doesn't have CONFIG_SCHED_SMT set) leads to:

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

Rather than define it in its own CONFIG_SCHED_SMT #define island, bunch it
up with test_idle_cores().

Fixes: ff7db0bf24db ("sched/numa: Prefer using an idle CPU as a migration target instead of comparing tasks")
[mgorman@techsingularity.net: Edit changelog, minor style change]
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
---
 kernel/sched/fair.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index fcc968669aea..10f9e6729fcf 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1520,9 +1520,6 @@ static inline bool is_core_idle(int cpu)
 	return true;
 }
 
-/* Forward declarations of select_idle_sibling helpers */
-static inline bool test_idle_cores(int cpu, bool def);
-
 struct task_numa_env {
 	struct task_struct *p;
 
@@ -1558,9 +1555,11 @@ numa_type numa_classify(unsigned int imbalance_pct,
 	return node_fully_busy;
 }
 
+#ifdef CONFIG_SCHED_SMT
+/* Forward declarations of select_idle_sibling helpers */
+static inline bool test_idle_cores(int cpu, bool def);
 static inline int numa_idle_core(int idle_core, int cpu)
 {
-#ifdef CONFIG_SCHED_SMT
 	if (!static_branch_likely(&sched_smt_present) ||
 	    idle_core >= 0 || !test_idle_cores(cpu, false))
 		return idle_core;
@@ -1571,10 +1570,15 @@ static inline int numa_idle_core(int idle_core, int cpu)
 	 */
 	if (is_core_idle(cpu))
 		idle_core = cpu;
-#endif
 
 	return idle_core;
 }
+#else
+static inline int numa_idle_core(int idle_core, int cpu)
+{
+	return idle_core;
+}
+#endif
 
 /*
  * Gather all necessary information to make NUMA balancing placement

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: Fix kernel build warning in test_idle_cores() for !SMT NUMA
  2020-02-27 14:02 [PATCH] sched/fair: Fix kernel build warning in test_idle_cores() for !SMT NUMA Mel Gorman
@ 2020-02-28 10:02 ` Lukasz Luba
  2020-03-03 10:08 ` Valentin Schneider
  1 sibling, 0 replies; 7+ messages in thread
From: Lukasz Luba @ 2020-02-28 10:02 UTC (permalink / raw)
  To: Mel Gorman, Ingo Molnar
  Cc: Peter Zijlstra, Vincent Guittot, Juri Lelli, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Valentin Schneider, Phil Auld,
	Hillf Danton, LKML



On 2/27/20 2:02 PM, Mel Gorman wrote:
> Building against tip/sched/core as of as ff7db0bf24db ("sched/numa: Prefer
> using an idle CPU as a migration target instead of comparing tasks") with
> the arm64 defconfig (which doesn't have CONFIG_SCHED_SMT set) leads to:
> 
>    kernel/sched/fair.c:1525:20: warning: ‘test_idle_cores’ declared ‘static’ but never defined [-Wunused-function]
>     static inline bool test_idle_cores(int cpu, bool def);
> 		      ^~~~~~~~~~~~~~~
> 
> Rather than define it in its own CONFIG_SCHED_SMT #define island, bunch it
> up with test_idle_cores().
> 
> Fixes: ff7db0bf24db ("sched/numa: Prefer using an idle CPU as a migration target instead of comparing tasks")
> [mgorman@techsingularity.net: Edit changelog, minor style change]
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
> ---
>   kernel/sched/fair.c | 14 +++++++++-----
>   1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index fcc968669aea..10f9e6729fcf 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1520,9 +1520,6 @@ static inline bool is_core_idle(int cpu)
>   	return true;
>   }
>   
> -/* Forward declarations of select_idle_sibling helpers */
> -static inline bool test_idle_cores(int cpu, bool def);
> -
>   struct task_numa_env {
>   	struct task_struct *p;
>   
> @@ -1558,9 +1555,11 @@ numa_type numa_classify(unsigned int imbalance_pct,
>   	return node_fully_busy;
>   }
>   
> +#ifdef CONFIG_SCHED_SMT
> +/* Forward declarations of select_idle_sibling helpers */
> +static inline bool test_idle_cores(int cpu, bool def);
>   static inline int numa_idle_core(int idle_core, int cpu)
>   {
> -#ifdef CONFIG_SCHED_SMT
>   	if (!static_branch_likely(&sched_smt_present) ||
>   	    idle_core >= 0 || !test_idle_cores(cpu, false))
>   		return idle_core;
> @@ -1571,10 +1570,15 @@ static inline int numa_idle_core(int idle_core, int cpu)
>   	 */
>   	if (is_core_idle(cpu))
>   		idle_core = cpu;
> -#endif
>   
>   	return idle_core;
>   }
> +#else
> +static inline int numa_idle_core(int idle_core, int cpu)
> +{
> +	return idle_core;
> +}
> +#endif
>   
>   /*
>    * Gather all necessary information to make NUMA balancing placement
> 

Looks good (apart from odd formatting got in '’') and calms down
yesterday's build of next (next-20200227 were I spotted it) and today's
also.

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

Regards,
Lukasz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: Fix kernel build warning in test_idle_cores() for !SMT NUMA
  2020-02-27 14:02 [PATCH] sched/fair: Fix kernel build warning in test_idle_cores() for !SMT NUMA Mel Gorman
  2020-02-28 10:02 ` Lukasz Luba
@ 2020-03-03 10:08 ` Valentin Schneider
  1 sibling, 0 replies; 7+ messages in thread
From: Valentin Schneider @ 2020-03-03 10:08 UTC (permalink / raw)
  To: Mel Gorman, Ingo Molnar
  Cc: Peter Zijlstra, Vincent Guittot, Juri Lelli, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Phil Auld, Hillf Danton, LKML,
	Lukasz Luba

On 2/27/20 2:02 PM, Mel Gorman wrote:
> Building against tip/sched/core as of as ff7db0bf24db ("sched/numa: Prefer
> using an idle CPU as a migration target instead of comparing tasks") with
> the arm64 defconfig (which doesn't have CONFIG_SCHED_SMT set) leads to:
> 
>   kernel/sched/fair.c:1525:20: warning: ‘test_idle_cores’ declared ‘static’ but never defined [-Wunused-function]
                                          ^               ^          ^      ^
For some reason the quotes got turned into â in your edit. Doesn't really
matter TBH.

>    static inline bool test_idle_cores(int cpu, bool def);
> 		      ^~~~~~~~~~~~~~~
> 
> Rather than define it in its own CONFIG_SCHED_SMT #define island, bunch it
> up with test_idle_cores().
> 
> Fixes: ff7db0bf24db ("sched/numa: Prefer using an idle CPU as a migration target instead of comparing tasks")
> [mgorman@techsingularity.net: Edit changelog, minor style change]
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>

Could we get this in tip (and hopefully -next will follow shortly)? We're at
like the third duplicate fix on the list already.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: Fix kernel build warning in test_idle_cores() for !SMT NUMA
  2020-02-27 12:08   ` Lukasz Luba
@ 2020-02-27 14:00     ` Mel Gorman
  0 siblings, 0 replies; 7+ messages in thread
From: Mel Gorman @ 2020-02-27 14:00 UTC (permalink / raw)
  To: Lukasz Luba
  Cc: Valentin Schneider, linux-kernel, mingo, peterz, vincent.guittot,
	dietmar.eggemann

On Thu, Feb 27, 2020 at 12:08:46PM +0000, Lukasz Luba wrote:
> Hi Valentin,
> 
> On 2/27/20 11:04 AM, Valentin Schneider wrote:
> > Hi Lukasz,
> > 
> > On 2/27/20 11:00 AM, Lukasz Luba wrote:
> > > Fix kernel build warning in kernel/sched/fair.c when CONFIG_SCHED_SMT is
> > > not set and CONFIG_NUMA_BALANCING is set.
> > > 
> > > kernel/sched/fair.c:1524:20: warning: ???test_idle_cores??? declared ???static??? but never defined [-Wunused-function]
> > > 
> > 
> > I've sent a similar fix yesterday at:
> > 
> > https://lore.kernel.org/lkml/20200226121244.7524-1-valentin.schneider@arm.com/
> > 
> 
> I've missed it. You are referring in the commit message to wrong change
> (probably HEAD of that branch), while when you try to bisect, it
> will point you to
> ff7db0bf24db sched/numa: Prefer using an idle CPU as a migration target
> instead of comparing tasks
> 
> I think Mel can simply resend the patches with correct build if Ingo
> is OK.
> 
> If Mel would decide to go with extended approach of ifdefs, then maybe
> it's also good to put in there  numa_idle_core(), which actually uses
> these test_idle_cores() and is_core_idle()
> 

I preferred the first fix. I'll send just it on with an editted changelog
to identify the exact patch that caused the problem. Ingo will hopefully
let me know if he prefers to pick up the fix on top or a resend of the
series with the fix folded in.

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: Fix kernel build warning in test_idle_cores() for !SMT NUMA
  2020-02-27 11:04 ` Valentin Schneider
@ 2020-02-27 12:08   ` Lukasz Luba
  2020-02-27 14:00     ` Mel Gorman
  0 siblings, 1 reply; 7+ messages in thread
From: Lukasz Luba @ 2020-02-27 12:08 UTC (permalink / raw)
  To: Valentin Schneider, linux-kernel
  Cc: mingo, peterz, vincent.guittot, dietmar.eggemann, mgorman

Hi Valentin,

On 2/27/20 11:04 AM, Valentin Schneider wrote:
> Hi Lukasz,
> 
> On 2/27/20 11:00 AM, Lukasz Luba wrote:
>> Fix kernel build warning in kernel/sched/fair.c when CONFIG_SCHED_SMT is
>> not set and CONFIG_NUMA_BALANCING is set.
>>
>> kernel/sched/fair.c:1524:20: warning: ‘test_idle_cores’ declared ‘static’ but never defined [-Wunused-function]
>>
> 
> I've sent a similar fix yesterday at:
> 
> https://lore.kernel.org/lkml/20200226121244.7524-1-valentin.schneider@arm.com/
> 

I've missed it. You are referring in the commit message to wrong change
(probably HEAD of that branch), while when you try to bisect, it
will point you to
ff7db0bf24db sched/numa: Prefer using an idle CPU as a migration target 
instead of comparing tasks

I think Mel can simply resend the patches with correct build if Ingo
is OK.

If Mel would decide to go with extended approach of ifdefs, then maybe
it's also good to put in there  numa_idle_core(), which actually uses
these test_idle_cores() and is_core_idle()

Regards,
Lukasz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sched/fair: Fix kernel build warning in test_idle_cores() for !SMT NUMA
  2020-02-27 11:00 Lukasz Luba
@ 2020-02-27 11:04 ` Valentin Schneider
  2020-02-27 12:08   ` Lukasz Luba
  0 siblings, 1 reply; 7+ messages in thread
From: Valentin Schneider @ 2020-02-27 11:04 UTC (permalink / raw)
  To: Lukasz Luba, linux-kernel
  Cc: mingo, peterz, vincent.guittot, dietmar.eggemann, mgorman

Hi Lukasz,

On 2/27/20 11:00 AM, Lukasz Luba wrote:
> Fix kernel build warning in kernel/sched/fair.c when CONFIG_SCHED_SMT is
> not set and CONFIG_NUMA_BALANCING is set.
> 
> kernel/sched/fair.c:1524:20: warning: ‘test_idle_cores’ declared ‘static’ but never defined [-Wunused-function]
> 

I've sent a similar fix yesterday at:

https://lore.kernel.org/lkml/20200226121244.7524-1-valentin.schneider@arm.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] sched/fair: Fix kernel build warning in test_idle_cores() for !SMT NUMA
@ 2020-02-27 11:00 Lukasz Luba
  2020-02-27 11:04 ` Valentin Schneider
  0 siblings, 1 reply; 7+ messages in thread
From: Lukasz Luba @ 2020-02-27 11:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, peterz, vincent.guittot, dietmar.eggemann, lukasz.luba, mgorman

Fix kernel build warning in kernel/sched/fair.c when CONFIG_SCHED_SMT is
not set and CONFIG_NUMA_BALANCING is set.

kernel/sched/fair.c:1524:20: warning: ‘test_idle_cores’ declared ‘static’ but never defined [-Wunused-function]

Fixes: ff7db0bf24db9 ("sched/numa: Prefer using an idle CPU as a migration target instead of comparing tasks")
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org> (SCHED_NORMAL)
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> (SCHED_NORMAL)
Cc: Mel Gorman <mgorman@techsingularity.net>
---

It's on top of tip [1] master branch (which has a merge of sched/urgent).

[1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git

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

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 4b5d5e5e701e..4441003b1ad1 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1520,8 +1520,10 @@ static inline bool is_core_idle(int cpu)
 	return true;
 }
 
+#ifdef CONFIG_SCHED_SMT
 /* Forward declarations of select_idle_sibling helpers */
 static inline bool test_idle_cores(int cpu, bool def);
+#endif
 
 struct task_numa_env {
 	struct task_struct *p;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-03-03 10:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27 14:02 [PATCH] sched/fair: Fix kernel build warning in test_idle_cores() for !SMT NUMA Mel Gorman
2020-02-28 10:02 ` Lukasz Luba
2020-03-03 10:08 ` Valentin Schneider
  -- strict thread matches above, loose matches on Subject: below --
2020-02-27 11:00 Lukasz Luba
2020-02-27 11:04 ` Valentin Schneider
2020-02-27 12:08   ` Lukasz Luba
2020-02-27 14:00     ` Mel Gorman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).