]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
fork: mv threads-max into kernel/fork.c
authorJoel Granados <joel.granados@kernel.org>
Fri, 2 May 2025 20:27:38 +0000 (22:27 +0200)
committerJoel Granados <joel.granados@kernel.org>
Wed, 23 Jul 2025 09:52:48 +0000 (11:52 +0200)
make sysctl_max_threads static as it no longer needs to be exported into
sysctl.c.

This is part of a greater effort to move ctl tables into their
respective subsystems which will reduce the merge conflicts in
kernel/sysctl.c.

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Joel Granados <joel.granados@kernel.org>
include/linux/sysctl.h
kernel/fork.c
kernel/sysctl.c

index ae762eabb7c9715e973356cadafbaaea3f20c7e9..30bcbc59d12d2f4cec7545e7ee3f5ea5f0eefbd7 100644 (file)
@@ -284,7 +284,4 @@ static inline bool sysctl_is_alias(char *param)
 }
 #endif /* CONFIG_SYSCTL */
 
-int sysctl_max_threads(const struct ctl_table *table, int write, void *buffer,
-               size_t *lenp, loff_t *ppos);
-
 #endif /* _LINUX_SYSCTL_H */
index 1ee8eb11f38bae1d2eb6de9494aea94b7a19e6c3..dea8e7740ad2cd0975a77546f78c8ee7e660c536 100644 (file)
@@ -3216,7 +3216,7 @@ int unshare_files(void)
        return 0;
 }
 
-int sysctl_max_threads(const struct ctl_table *table, int write,
+static int sysctl_max_threads(const struct ctl_table *table, int write,
                       void *buffer, size_t *lenp, loff_t *ppos)
 {
        struct ctl_table t;
@@ -3238,3 +3238,21 @@ int sysctl_max_threads(const struct ctl_table *table, int write,
 
        return 0;
 }
+
+static const struct ctl_table fork_sysctl_table[] = {
+       {
+               .procname       = "threads-max",
+               .data           = NULL,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = sysctl_max_threads,
+       },
+};
+
+static int __init init_fork_sysctl(void)
+{
+       register_sysctl_init("kernel", fork_sysctl_table);
+       return 0;
+}
+
+subsys_initcall(init_fork_sysctl);
index 718140251972b797f5aa5a056de40e8856805eed..febf328054aa5a7b2462a256598f86f5ded87c90 100644 (file)
@@ -1630,13 +1630,6 @@ static const struct ctl_table kern_table[] = {
                .proc_handler   = proc_do_cad_pid,
        },
 #endif
-       {
-               .procname       = "threads-max",
-               .data           = NULL,
-               .maxlen         = sizeof(int),
-               .mode           = 0644,
-               .proc_handler   = sysctl_max_threads,
-       },
        {
                .procname       = "overflowuid",
                .data           = &overflowuid,