linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Fix an unused function warning
@ 2021-04-21 14:01 Arnd Bergmann
  2021-04-21 14:14 ` Valentin Schneider
  2021-04-21 14:15 ` Vincent Guittot
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2021-04-21 14:01 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Valentin Schneider
  Cc: Arnd Bergmann, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Vincent Donnefort,
	Paul Turner, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

Without CONFIG_NO_HZ_COMMON, there is now a warning about update_nohz_stats
after the last caller outside the #ifdef was removed

kernel/sched/fair.c:8433:13: error: 'update_nohz_stats' defined but not used [-Werror=unused-function]
 8433 | static bool update_nohz_stats(struct rq *rq)

Simplify the function by removing the #ifdef inside it and move it into
the block in which it gets called.

Fixes: 0826530de3cb ("sched/fair: Remove update of blocked load from newidle_balance")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/sched/fair.c | 40 ++++++++++++++++++----------------------
 1 file changed, 18 insertions(+), 22 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index df2083d2dd0c..7c3edbb5ec70 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8430,28 +8430,6 @@ group_type group_classify(unsigned int imbalance_pct,
 	return group_has_spare;
 }
 
-static bool update_nohz_stats(struct rq *rq)
-{
-#ifdef CONFIG_NO_HZ_COMMON
-	unsigned int cpu = rq->cpu;
-
-	if (!rq->has_blocked_load)
-		return false;
-
-	if (!cpumask_test_cpu(cpu, nohz.idle_cpus_mask))
-		return false;
-
-	if (!time_after(jiffies, READ_ONCE(rq->last_blocked_load_update_tick)))
-		return true;
-
-	update_blocked_averages(cpu);
-
-	return rq->has_blocked_load;
-#else
-	return false;
-#endif
-}
-
 /**
  * update_sg_lb_stats - Update sched_group's statistics for load balancing.
  * @env: The load balancing environment.
@@ -10123,6 +10101,24 @@ static inline int on_null_domain(struct rq *rq)
 }
 
 #ifdef CONFIG_NO_HZ_COMMON
+static bool update_nohz_stats(struct rq *rq)
+{
+	unsigned int cpu = rq->cpu;
+
+	if (!rq->has_blocked_load)
+		return false;
+
+	if (!cpumask_test_cpu(cpu, nohz.idle_cpus_mask))
+		return false;
+
+	if (!time_after(jiffies, READ_ONCE(rq->last_blocked_load_update_tick)))
+		return true;
+
+	update_blocked_averages(cpu);
+
+	return rq->has_blocked_load;
+}
+
 /*
  * idle load balancing details
  * - When one of the busy CPUs notice that there may be an idle rebalancing
-- 
2.29.2


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

* Re: [PATCH] sched/fair: Fix an unused function warning
  2021-04-21 14:01 [PATCH] sched/fair: Fix an unused function warning Arnd Bergmann
@ 2021-04-21 14:14 ` Valentin Schneider
  2021-04-21 14:15 ` Vincent Guittot
  1 sibling, 0 replies; 3+ messages in thread
From: Valentin Schneider @ 2021-04-21 14:14 UTC (permalink / raw)
  To: Arnd Bergmann, Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Arnd Bergmann, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Vincent Donnefort,
	Paul Turner, linux-kernel


Hi,

On 21/04/21 16:01, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Without CONFIG_NO_HZ_COMMON, there is now a warning about update_nohz_stats
> after the last caller outside the #ifdef was removed
>
> kernel/sched/fair.c:8433:13: error: 'update_nohz_stats' defined but not used [-Werror=unused-function]
>  8433 | static bool update_nohz_stats(struct rq *rq)
>
> Simplify the function by removing the #ifdef inside it and move it into
> the block in which it gets called.
>
> Fixes: 0826530de3cb ("sched/fair: Remove update of blocked load from newidle_balance")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

That should be covered by:

  3f5ad91488e8 ("sched/fair: Move update_nohz_stats() to the CONFIG_NO_HZ_COMMON block to simplify the code & fix an unused function warning")

which currently sits in tip/sched/core. We might want to shove that in
tip/sched/urgent along with the latest in-flight fixes.

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

* Re: [PATCH] sched/fair: Fix an unused function warning
  2021-04-21 14:01 [PATCH] sched/fair: Fix an unused function warning Arnd Bergmann
  2021-04-21 14:14 ` Valentin Schneider
@ 2021-04-21 14:15 ` Vincent Guittot
  1 sibling, 0 replies; 3+ messages in thread
From: Vincent Guittot @ 2021-04-21 14:15 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Valentin Schneider,
	Arnd Bergmann, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Vincent Donnefort,
	Paul Turner, linux-kernel

Hi Arnd,

A similar patch has already been merged in tip/sched/core:
161890837554.29796.9442405099846421634.tip-bot2@tip-bot2

Regards,
Vincent

On Wed, 21 Apr 2021 at 16:01, Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> Without CONFIG_NO_HZ_COMMON, there is now a warning about update_nohz_stats
> after the last caller outside the #ifdef was removed
>
> kernel/sched/fair.c:8433:13: error: 'update_nohz_stats' defined but not used [-Werror=unused-function]
>  8433 | static bool update_nohz_stats(struct rq *rq)
>
> Simplify the function by removing the #ifdef inside it and move it into
> the block in which it gets called.
>
> Fixes: 0826530de3cb ("sched/fair: Remove update of blocked load from newidle_balance")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  kernel/sched/fair.c | 40 ++++++++++++++++++----------------------
>  1 file changed, 18 insertions(+), 22 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index df2083d2dd0c..7c3edbb5ec70 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8430,28 +8430,6 @@ group_type group_classify(unsigned int imbalance_pct,
>         return group_has_spare;
>  }
>
> -static bool update_nohz_stats(struct rq *rq)
> -{
> -#ifdef CONFIG_NO_HZ_COMMON
> -       unsigned int cpu = rq->cpu;
> -
> -       if (!rq->has_blocked_load)
> -               return false;
> -
> -       if (!cpumask_test_cpu(cpu, nohz.idle_cpus_mask))
> -               return false;
> -
> -       if (!time_after(jiffies, READ_ONCE(rq->last_blocked_load_update_tick)))
> -               return true;
> -
> -       update_blocked_averages(cpu);
> -
> -       return rq->has_blocked_load;
> -#else
> -       return false;
> -#endif
> -}
> -
>  /**
>   * update_sg_lb_stats - Update sched_group's statistics for load balancing.
>   * @env: The load balancing environment.
> @@ -10123,6 +10101,24 @@ static inline int on_null_domain(struct rq *rq)
>  }
>
>  #ifdef CONFIG_NO_HZ_COMMON
> +static bool update_nohz_stats(struct rq *rq)
> +{
> +       unsigned int cpu = rq->cpu;
> +
> +       if (!rq->has_blocked_load)
> +               return false;
> +
> +       if (!cpumask_test_cpu(cpu, nohz.idle_cpus_mask))
> +               return false;
> +
> +       if (!time_after(jiffies, READ_ONCE(rq->last_blocked_load_update_tick)))
> +               return true;
> +
> +       update_blocked_averages(cpu);
> +
> +       return rq->has_blocked_load;
> +}
> +
>  /*
>   * idle load balancing details
>   * - When one of the busy CPUs notice that there may be an idle rebalancing
> --
> 2.29.2
>

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

end of thread, other threads:[~2021-04-21 14:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 14:01 [PATCH] sched/fair: Fix an unused function warning Arnd Bergmann
2021-04-21 14:14 ` Valentin Schneider
2021-04-21 14:15 ` Vincent Guittot

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