This is a note to let you know that I've just added the patch titled sched: Fix DEBUG && !SCHEDSTATS warn to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: sched-fix-debug-schedstats-warn.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 769fdf83df57b373660343ef4270b3ada91ef434 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Date: Wed, 6 Oct 2021 10:12:05 +0200 Subject: sched: Fix DEBUG && !SCHEDSTATS warn From: Peter Zijlstra <peterz@xxxxxxxxxxxxx> commit 769fdf83df57b373660343ef4270b3ada91ef434 upstream. 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: cb3e971c435d ("sched: Make struct sched_statistics independent of fair sched class") Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- kernel/sched/debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -462,7 +462,8 @@ static void print_cfs_group_stats(struct PN(se->sum_exec_runtime); if (schedstat_enabled()) { - struct sched_statistics *stats = __schedstats_from_se(se); + struct sched_statistics *stats; + stats = __schedstats_from_se(se); PN_SCHEDSTAT(wait_start); PN_SCHEDSTAT(sleep_start); Patches currently in stable-queue which might be from peterz@xxxxxxxxxxxxx are queue-5.15/sched-rt-fix-bad-task-migration-for-rt-tasks.patch queue-5.15/sched-make-struct-sched_statistics-independent-of-fa.patch queue-5.15/sched-fair-use-__schedstat_set-in-set_next_entity.patch queue-5.15/sched-fair-fix-inaccurate-tally-of-ttwu_move_affine.patch queue-5.15/perf-core-fix-hardlockup-failure-caused-by-perf-thro.patch queue-5.15/revert-objtool-support-addition-to-set-cfa-base.patch queue-5.15/sched-fix-debug-schedstats-warn.patch