Skip to content

Commit 769fdf8

Browse files
author
Peter Zijlstra
committed
sched: Fix DEBUG && !SCHEDSTATS warn
When !SCHEDSTATS schedstat_enabled() is an unconditional 0 and the whole block doesn't exist, however GCC figures the scoped variable 'stats' is unused and complains about it. Upgrade the warning from -Wunused-variable to -Wunused-but-set-variable by writing it in two statements. This fixes the build because the new warning is in W=1. Given that whole if(0) {} thing, I don't feel motivated to change things overly much and quite strongly feel this is the compiler being daft. Fixes: cb3e971 ("sched: Make struct sched_statistics independent of fair sched class") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
1 parent a7ba894 commit 769fdf8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/sched/debug.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,8 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group
463463
PN(se->sum_exec_runtime);
464464

465465
if (schedstat_enabled()) {
466-
struct sched_statistics *stats = __schedstats_from_se(se);
466+
struct sched_statistics *stats;
467+
stats = __schedstats_from_se(se);
467468

468469
PN_SCHEDSTAT(wait_start);
469470
PN_SCHEDSTAT(sleep_start);

0 commit comments

Comments
 (0)