Skip to content

Commit 509466b

Browse files
Qian CaiIngo Molnar
authored andcommitted
sched/fair: Fix "runnable_avg_yN_inv" not used warnings
runnable_avg_yN_inv[] is only used in kernel/sched/pelt.c but was included in several other places because they need other macros all came from kernel/sched/sched-pelt.h which was generated by Documentation/scheduler/sched-pelt. As the result, it causes compilation a lot of warnings, kernel/sched/sched-pelt.h:4:18: warning: 'runnable_avg_yN_inv' defined but not used [-Wunused-const-variable=] kernel/sched/sched-pelt.h:4:18: warning: 'runnable_avg_yN_inv' defined but not used [-Wunused-const-variable=] kernel/sched/sched-pelt.h:4:18: warning: 'runnable_avg_yN_inv' defined but not used [-Wunused-const-variable=] ... Silence it by appending the __maybe_unused attribute for it, so all generated variables and macros can still be kept in the same file. Signed-off-by: Qian Cai <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent b0c7922 commit 509466b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Documentation/scheduler/sched-pelt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ void calc_runnable_avg_yN_inv(void)
2020
int i;
2121
unsigned int x;
2222

23-
printf("static const u32 runnable_avg_yN_inv[] = {");
23+
/* To silence -Wunused-but-set-variable warnings. */
24+
printf("static const u32 runnable_avg_yN_inv[] __maybe_unused = {");
2425
for (i = 0; i < HALFLIFE; i++) {
2526
x = ((1UL<<32)-1)*pow(y, i);
2627

kernel/sched/sched-pelt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
/* Generated by Documentation/scheduler/sched-pelt; do not modify. */
33

4-
static const u32 runnable_avg_yN_inv[] = {
4+
static const u32 runnable_avg_yN_inv[] __maybe_unused = {
55
0xffffffff, 0xfa83b2da, 0xf5257d14, 0xefe4b99a, 0xeac0c6e6, 0xe5b906e6,
66
0xe0ccdeeb, 0xdbfbb796, 0xd744fcc9, 0xd2a81d91, 0xce248c14, 0xc9b9bd85,
77
0xc5672a10, 0xc12c4cc9, 0xbd08a39e, 0xb8fbaf46, 0xb504f333, 0xb123f581,

0 commit comments

Comments
 (0)