kernel/fork: move threads-max sysctl to its own file
Subsystems (5)
PATCH 4/11 kernel/fork: move threads-max sysctl to its own file
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places where they actually belong. The proc sysctl maintainers do not want to know what sysctl knobs you wish to add for your own piece of code, we just care about the core logic.
All filesystem syctls now get reviewed by fs folks. This commit follows the commit of fs, move the threads-max sysctl to its own file, kernel/fork.c.
Signed-off-by tangmeng <[email protected]>
--- include/linux/sysctl.h | 3 --- kernel/fork.c | 22 +++++++++++++++++++++- kernel/sysctl.c | 7 ------- 3 files changed, 21 insertions(+), 11 deletions(-)
include/linux/sysctl.h +0 -3
@@ -295,7 +295,4 @@ static inline void do_sysctl_args(void) }#endif /* CONFIG_SYSCTL */ -int sysctl_max_threads (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos); -#endif /* _LINUX_SYSCTL_H */
kernel/fork.c +21 -1
@@ -3143,7 +3143,8 @@ int unshare_files(void)return 0 ; } -int sysctl_max_threads (struct ctl_table *table,int write, +#ifdef CONFIG_SYSCTL +static int sysctl_max_threads (struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct ctl_table t;
@@ -3165,3 +3166,22 @@ int sysctl_max_threads(struct ctl_table *table, int write, return 0; } + +static struct ctl_table kern_fork_table[] = { + { + .procname ="threads-max" , + .data =NULL , + .maxlen =sizeof (int ), + .mode =0644 , + .proc_handler = sysctl_max_threads, + }, + { } +}; + +static __init int kernel_fork_sysctls_init (void ) +{ +register_sysctl_init ("kernel" , kern_fork_table); +return 0 ; +} +late_initcall (kernel_fork_sysctls_init); +#endif /* CONFIG_SYSCTL */
kernel/sysctl.c +0 -7
@@ -1829,13 +1829,6 @@ static 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 = "usermodehelper", .mode = 0555,
Signature · 1 line
2.20.1