public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH v4 5/5] sysctl: delete six_hundred_forty_kb to save 4 bytes
@ 2024-10-08 15:17 ` Wen Yang
  2024-10-09  8:58   ` Joel Granados
  0 siblings, 1 reply; 2+ messages in thread
From: Wen Yang @ 2024-10-08 15:17 UTC (permalink / raw)
  To: Joel Granados, Luis Chamberlain, Kees Cook
  Cc: Eric W . Biederman, Christian Brauner, Thomas Weißschuh,
	linux-kernel, Wen Yang, Dave Young

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 <wen.yang@linux.dev>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Joel Granados <j.granados@samsung.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Dave Young <dyoung@redhat.com>
Cc: linux-kernel@vger.kernel.org
---
 kernel/sysctl.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 05197d46007d..c8460b5e0605 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -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",
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESEND PATCH v4 5/5] sysctl: delete six_hundred_forty_kb to save 4 bytes
  2024-10-08 15:17 ` [RESEND PATCH v4 5/5] sysctl: delete six_hundred_forty_kb to save 4 bytes Wen Yang
@ 2024-10-09  8:58   ` Joel Granados
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Granados @ 2024-10-09  8:58 UTC (permalink / raw)
  To: Wen Yang
  Cc: Luis Chamberlain, Kees Cook, Eric W . Biederman,
	Christian Brauner, Thomas Weißschuh, linux-kernel,
	Dave Young, joel.granados

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 joel.granados@kernel.org. please send all sysctl
related stuff there, I might miss it if it lands here.

Best


On Tue, Oct 08, 2024 at 11:17:00PM +0800, Wen Yang wrote:
> 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 <wen.yang@linux.dev>
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Joel Granados <j.granados@samsung.com>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Cc: Christian Brauner <brauner@kernel.org>
> Cc: Dave Young <dyoung@redhat.com>
> Cc: linux-kernel@vger.kernel.org
> ---
>  kernel/sysctl.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 05197d46007d..c8460b5e0605 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -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",
> -- 
> 2.25.1
> 

-- 

Joel Granados

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-09  8:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20241008151741eucas1p15a64c181565d210e6fdf23df870ee7c9@eucas1p1.samsung.com>
2024-10-08 15:17 ` [RESEND PATCH v4 5/5] sysctl: delete six_hundred_forty_kb to save 4 bytes Wen Yang
2024-10-09  8:58   ` Joel Granados

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox