Skip to contentSkip to conversation

sysctl: Fix 'one_thousand' defined but not used warning

PATCH In review Suren Baghdasaryan 3 participants 3 messages Jan 17, 2022 – Jan 23, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysctl: Fix 'one_thousand' defined but not used warning

Fix the following warning issued when CONFIG_PERF_EVENTS is not defined:

kernel/sysctl.c:125:12: warning: 'one_thousand' defined but not used [-Wunused-variable]

Fixes 39c65a94cd96 ("mm/pagealloc: sysctl: change watermark_scale_factor max limit to 30%")
---
 kernel/sysctl.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/sysctl.c +2 -0
index ef77be575d87..81a6f2d47f77 100644
@@ -122,7 +122,9 @@ static unsigned long one_ul = 1;
 static unsigned long long_max = LONG_MAX;
 static int one_hundred = 100;
 static int two_hundred = 200;
+#ifdef CONFIG_PERF_EVENTS
 static int one_thousand = 1000;
+#endif
 static int three_thousand = 3000;
 #ifdef CONFIG_PRINTK
 static int ten_thousand = 10000;
Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog
#1 lore raw
Quoted 17 lines · Suren Baghdasaryan

Fix the following warning issued when CONFIG_PERF_EVENTS is not defined:

kernel/sysctl.c:125:12: warning: 'one_thousand' defined but not used [-Wunused-variable]

Fixes 39c65a94cd96 ("mm/pagealloc: sysctl: change watermark_scale_factor max limit to 30%")
---
 kernel/sysctl.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/sysctl.c +0 -0
index ef77be575d87..81a6f2d47f77 100644

kernel/sysctl.c static unsigned long one_ul = 1; · line 126

Quoted 5 lines
kernel/sysctl.c +1 -0
@@ -122,7 +122,9 @@ static unsigned long one_ul = 1;
 static unsigned long long_max = LONG_MAX;
 static int one_hundred = 100;
 static int two_hundred = 200;
+#ifdef CONFIG_PERF_EVENTS
 static int one_thousand = 1000;

what about moving one_thousand definition below to group it with six_hundred_forty_kb var together, so that we can avoid one #ifdef CONFIG_PERF_EVENTS ... #endif

Quoted 7 lines
kernel/sysctl.c +1 -0
+#endif
 static int three_thousand = 3000;
 #ifdef CONFIG_PRINTK
 static int ten_thousand = 10000;
Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog
#2 lore raw

Hi Jisheng,

Quoted 14 lines · On Sun, 23 Jan 2022 17:09:36 +0800 Jisheng Zhang <[email protected]> wrote:
Quoted 12 lines · Suren Baghdasaryan

Fix the following warning issued when CONFIG_PERF_EVENTS is not defined:

kernel/sysctl.c:125:12: warning: 'one_thousand' defined but not used [-Wunused-variable]

Fixes 39c65a94cd96 ("mm/pagealloc: sysctl: change watermark_scale_factor max limit to 30%")
---
 kernel/sysctl.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 22 lines

kernel/sysctl.c static unsigned long one_ul = 1; · line 126

Quoted 10 lines
kernel/sysctl.c +1 -0
index ef77be575d87..81a6f2d47f77 100644
@@ -122,7 +122,9 @@ static unsigned long one_ul = 1;
 static unsigned long long_max = LONG_MAX;
 static int one_hundred = 100;
 static int two_hundred = 200;
+#ifdef CONFIG_PERF_EVENTS
 static int one_thousand = 1000;  

what about moving one_thousand definition below to group it with six_hundred_forty_kb var together, so that we can avoid one #ifdef CONFIG_PERF_EVENTS ... #endif

Quoted 7 lines
kernel/sysctl.c +1 -0
+#endif
 static int three_thousand = 3000;
 #ifdef CONFIG_PRINTK
 static int ten_thousand = 10000;
Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog

This has been fixed in Linus' current tree.

Signature · 2 lines
Cheers,
Stephen Rothwell