sysctl: delete six_hundred_forty_kb to save 4 bytes
PATCH RESEND v4 5/5 sysctl: delete six_hundred_forty_kb to save 4 bytes
By directly encoding specific numbers into the min/max field, unnecessary global variable six_hundred_forty_kb can be removed, saving 4 bytes
Signed-off-by Wen Yang <[email protected]>
Cc Luis Chamberlain <[email protected]>
Cc Kees Cook <[email protected]>
Cc Joel Granados <[email protected]>
Cc Eric W. Biederman <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Dave Young <[email protected]>
--- kernel/sysctl.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
kernel/sysctl.c +3 -10
@@ -90,13 +90,6 @@ EXPORT_SYMBOL_GPL(sysctl_long_vals);#if defined(CONFIG_SYSCTL ) -/* Constants used for minimum and maximum */ - -#ifdef CONFIG_PERF_EVENTS -static const int six_hundred_forty_kb =640 *1024 ; -#endif - -static const int ngroups_max =NGROUPS_MAX ;static const int cap_last_cap =CAP_LAST_CAP ;
@@ -1964,10 +1957,10 @@ static struct ctl_table kern_table[] = { .procname = "perf_event_max_stack", .data = &sysctl_perf_event_max_stack, .maxlen = sizeof(sysctl_perf_event_max_stack), - .mode = 0644, + .mode = 0644 | SYSCTL_FLAG_MIN | SYSCTL_FLAG_MAX, .proc_handler = perf_event_max_stack_handler, - .extra1 = SYSCTL_ZERO, - .extra2 = (void *)&six_hundred_forty_kb, + .min = 0, + .max = 640 * 1024, }, { .procname = "perf_event_max_contexts_per_stack",
Signature · 1 line
2.25.1
Hey
I have the last version in line for review this week. I'll ignore this "resend" as it is the same as the previous email.
FYI: I have moved to [email protected]. please send all sysctl related stuff there, I might miss it if it lands here.
Best
Quoted 51 lines · Wen Yang
By directly encoding specific numbers into the min/max field, unnecessary global variable
six_hundred_forty_kbcan be removed, saving 4 bytesSigned-off-by Wen Yang <[email protected]>Cc Luis Chamberlain <[email protected]>Cc Kees Cook <[email protected]>Cc Joel Granados <[email protected]>Cc Eric W. Biederman <[email protected]>Cc Christian Brauner <[email protected]>Cc Dave Young <[email protected]>--- kernel/sysctl.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)kernel/sysctl.c +3
-10@@ -90,13 +90,6 @@ EXPORT_SYMBOL_GPL(sysctl_long_vals);#if defined(CONFIG_SYSCTL ) -/* Constants used for minimum and maximum */ - -#ifdef CONFIG_PERF_EVENTS -static const int six_hundred_forty_kb =640 *1024 ; -#endif - -static const int ngroups_max =NGROUPS_MAX ;static const int cap_last_cap =CAP_LAST_CAP ;@@ -1964,10 +1957,10 @@ static struct ctl_table kern_table[] = { .procname = "perf_event_max_stack", .data = &sysctl_perf_event_max_stack, .maxlen = sizeof(sysctl_perf_event_max_stack), - .mode = 0644, + .mode = 0644 | SYSCTL_FLAG_MIN | SYSCTL_FLAG_MAX, .proc_handler = perf_event_max_stack_handler, - .extra1 = SYSCTL_ZERO, - .extra2 = (void *)&six_hundred_forty_kb, + .min = 0, + .max = 640 * 1024, }, { .procname = "perf_event_max_contexts_per_stack",Signature · 1 line
2.25.1
Signature · 1 line
Joel Granados