linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/fair: fix variable "done" set but not used
@ 2019-05-25 16:18 Qian Cai
  2019-05-26 23:56 ` Valentin Schneider
  0 siblings, 1 reply; 9+ messages in thread
From: Qian Cai @ 2019-05-25 16:18 UTC (permalink / raw)
  To: peterz, mingo; +Cc: vincent.guittot, linux-kernel, Qian Cai

The commit f643ea220701 ("sched/nohz: Stop NOHZ stats when decayed")
introduced a compilation warning if CONFIG_NO_HZ_COMMON=n,

kernel/sched/fair.c: In function 'update_blocked_averages':
kernel/sched/fair.c:7750:7: warning: variable 'done' set but not used
[-Wunused-but-set-variable]

Fix it by adding a couple of "ifdef" macros as the variable is only
needed when CONFIG_NO_HZ_COMMON=y.

Signed-off-by: Qian Cai <cai@lca.pw>
---
 kernel/sched/fair.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index f35930f5e528..c8682acf4508 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7747,7 +7747,9 @@ static void update_blocked_averages(int cpu)
 	struct cfs_rq *cfs_rq, *pos;
 	const struct sched_class *curr_class;
 	struct rq_flags rf;
+#ifdef CONFIG_NO_HZ_COMMON
 	bool done = true;
+#endif
 
 	rq_lock_irqsave(rq, &rf);
 	update_rq_clock(rq);
@@ -7774,20 +7776,22 @@ static void update_blocked_averages(int cpu)
 		if (cfs_rq_is_decayed(cfs_rq))
 			list_del_leaf_cfs_rq(cfs_rq);
 
+#ifdef CONFIG_NO_HZ_COMMON
 		/* Don't need periodic decay once load/util_avg are null */
 		if (cfs_rq_has_blocked(cfs_rq))
 			done = false;
 	}
+#endif
 
 	curr_class = rq->curr->sched_class;
 	update_rt_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &rt_sched_class);
 	update_dl_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &dl_sched_class);
 	update_irq_load_avg(rq, 0);
+#ifdef CONFIG_NO_HZ_COMMON
 	/* Don't need periodic decay once load/util_avg are null */
 	if (others_have_blocked(rq))
 		done = false;
 
-#ifdef CONFIG_NO_HZ_COMMON
 	rq->last_blocked_load_update_tick = jiffies;
 	if (done)
 		rq->has_blocked_load = 0;
-- 
2.20.1 (Apple Git-117)


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

end of thread, other threads:[~2019-06-03 11:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-25 16:18 [PATCH] sched/fair: fix variable "done" set but not used Qian Cai
2019-05-26 23:56 ` Valentin Schneider
2019-05-27  0:53   ` Qian Cai
2019-05-27 13:25     ` Valentin Schneider
2019-06-02 16:41     ` [PATCH] sched/fair: Cleanup definition of NOHZ blocked load functions Valentin Schneider
2019-06-03  9:38       ` Peter Zijlstra
2019-06-03  9:53         ` Vincent Guittot
2019-06-03 10:22         ` Valentin Schneider
2019-06-03 11:26           ` Peter Zijlstra

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