fs/drop_caches: move drop_caches sysctls to its own file
Subsystems (4)
PATCH v2 10/11 fs/drop_caches: move drop_caches sysctls 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 drop_caches sysctls to its own file, fs/drop_caches.c.
--- fs/drop_caches.c | 24 ++++++++++++++++++++++-- include/linux/mm.h | 6 ------ kernel/sysctl.c | 9 --------- 3 files changed, 22 insertions(+), 17 deletions(-)
fs/drop_caches.c +22 -2
@@ -13,7 +13,7 @@#include "internal.h" /* A global variable is a bit ugly, but it keeps the code simple */ -int sysctl_drop_caches; +static int sysctl_drop_caches;static void drop_pagecache_sb (struct super_block *sb,void *unused) {
@@ -47,7 +47,7 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused)iput (toput_inode); } -int drop_caches_sysctl_handler (struct ctl_table *table,int write, +static int drop_caches_sysctl_handler (struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {int ret;
@@ -75,3 +75,23 @@ int drop_caches_sysctl_handler(struct ctl_table *table, int write, }return 0 ; } + +static struct ctl_table vm_drop_caches_table[] = { + { + .procname ="drop_caches" , + .data = &sysctl_drop_caches, + .maxlen =sizeof (int ), + .mode =0200 , + .proc_handler = drop_caches_sysctl_handler, + .extra1 =SYSCTL_ONE , + .extra2 =SYSCTL_FOUR , + }, + { } +}; + +static __init int vm_drop_caches_sysctls_init (void ) +{ +register_sysctl_init ("vm" , vm_drop_caches_table); +return 0 ; +} +late_initcall (vm_drop_caches_sysctls_init);
include/linux/mm.h +0 -6
@@ -3126,12 +3126,6 @@ static inline int in_gate_area(struct mm_struct *mm, unsigned long addr)extern bool process_shares_mm (struct task_struct *p,struct mm_struct *mm); -#ifdef CONFIG_SYSCTL -extern int sysctl_drop_caches; -int drop_caches_sysctl_handler (struct ctl_table *,int ,void *,size_t *, -loff_t *); -#endif -void drop_slab (void );#ifndef CONFIG_MMU
kernel/sysctl.c +0 -9
@@ -2182,15 +2182,6 @@ static struct ctl_table vm_table[] = { .mode = 0644, .proc_handler = lowmem_reserve_ratio_sysctl_handler, }, - { - .procname = "drop_caches", - .data = &sysctl_drop_caches, - .maxlen = sizeof(int), - .mode = 0200, - .proc_handler = drop_caches_sysctl_handler, - .extra1 = SYSCTL_ONE, - .extra2 = SYSCTL_FOUR, - },#ifdef CONFIG_COMPACTION { .procname = "compact_memory",
Signature · 1 line
2.20.1
Quoted 8 lines · tangmeng
kernel/sysctl.cis 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.
Quoted 5 lines
All filesystem syctls now get reviewed by fs folks. This commit follows the commit of fs, move the
drop_cachessysctls to its own file,fs/drop_caches.c.Signed-off-by tangmeng <[email protected]>
Thanks but please send a v3 including all the other patches as well and collecting the Reviewed/Acked-bys, etc. This can be sent *after* your v3 of the optimization work.
Luis
Quoted 5 lines · Luis Chamberlain
Thanks but please send a v3 including all the other patches as well and collecting the Reviewed/Acked-bys, etc. This can be sent *after* your v3 of the optimization work.
OKay, I will send a v3 including all the other patches as well and collecting the Reviewed/Acked-bys after completing the optimization work and supplement the contents you mentioned.
In fact, I submitted two series of optimization patches.
One is the one you just reviewed for struct ctl_path optimization patch, and the another one for struct ctl_table has not been reviewed yet.
The patch for struct ctl_table optimization's subject is:
[[PATCH] fs/proc: optimize exactly register one ctl_table]
Thanks
Quoted 5 lines · Luis Chamberlain
Thanks but please send a v3 including all the other patches as well and collecting the Reviewed/Acked-bys, etc. This can be sent *after* your v3 of the optimization work.
I have noticed that there is a conflict between sysctl-next and linux-next. Do I resubmit the patch based on linux-next, or after you deal with the conflict between sysctl-next and linux-next, I resubmit based on sysctl-next?
Quoted 5 lines · tangmeng
Quoted 1 line · Luis Chamberlain
Quoted 8 lines
Quoted 4 lines
Thanks but please send a v3 including all the other patches as well and collecting the Reviewed/Acked-bys, etc. This can be sent *after* your v3 of the optimization work.
I have noticed that there is a conflict between sysctl-next and linux-next. Do I resubmit the patch based on linux-next, or after you deal with the conflict between sysctl-next and linux-next, I resubmit based on sysctl-next?
You can use sysctl-next now to base your development changes. Feel free to send more changes.
Luis