All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] sched/fair: Fix unused function warning
@ 2021-03-27 13:56 YueHaibing
  2021-03-29 12:35 ` Vincent Guittot
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2021-03-27 13:56 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, bristot
  Cc: linux-kernel, YueHaibing

while CONFIG_NO_HZ_COMMON is not enabled, gcc warn this:

kernel/sched/fair.c:8398:13: warning: ‘update_nohz_stats’ defined but not used [-Wunused-function]
 static bool update_nohz_stats(struct rq *rq)
             ^~~~~~~~~~~~~~~~~

Move update_nohz_stats() to #ifdef block fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 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 6d73bdbb2d40..c7a7ef97d167 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8395,28 +8395,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.
@@ -10097,6 +10075,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.17.1


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

* Re: [PATCH -next] sched/fair: Fix unused function warning
  2021-03-27 13:56 [PATCH -next] sched/fair: Fix unused function warning YueHaibing
@ 2021-03-29 12:35 ` Vincent Guittot
  0 siblings, 0 replies; 2+ messages in thread
From: Vincent Guittot @ 2021-03-29 12:35 UTC (permalink / raw)
  To: YueHaibing
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, linux-kernel

Hi,

On Sat, 27 Mar 2021 at 14:59, YueHaibing <yuehaibing@huawei.com> wrote:
>
> while CONFIG_NO_HZ_COMMON is not enabled, gcc warn this:
>
> kernel/sched/fair.c:8398:13: warning: ‘update_nohz_stats’ defined but not used [-Wunused-function]
>  static bool update_nohz_stats(struct rq *rq)
>              ^~~~~~~~~~~~~~~~~
>
> Move update_nohz_stats() to #ifdef block fix this.

Could you add a fix tag  ?
Fixes: 0826530de3cb ("sched/fair: Remove update of blocked load from
newidle_balance")

Also could you move update_nohz_stats() closer to its only caller
_nohz_idle_balance()

With these small nits above:

Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>

>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  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 6d73bdbb2d40..c7a7ef97d167 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8395,28 +8395,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.
> @@ -10097,6 +10075,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.17.1
>

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

end of thread, other threads:[~2021-03-29 12:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-27 13:56 [PATCH -next] sched/fair: Fix unused function warning YueHaibing
2021-03-29 12:35 ` Vincent Guittot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.