sysctl: change vm.drop_caches perm to 0200 to avoid misleading
PATCH 1/1 sysctl: change vm.drop_caches perm to 0200 to avoid misleading
From: Cheng Renquan <[email protected]>
The original vm.drop_caches perm is 0644 that allows users to read its current value, that is quite misleading, I read articles often on that topic teaching people how to see its current value, and how to change its value to 3; that would make readers to misunderstand that varaiable works like a long time state variable, and have long time effect after writing its value to 3:
http://www.penglixun.com/tech/system/manual_free_linux_memory.html
In fact, this value is for debugging purpose only, and only effect while writing, means during writing its value to 3, the kernel would reclaim pagecache and slabcache memory explicitly, it works for only one time; so only its write permission is meaningful, reading that var's current value is meaningless and quite misleading, and the best way to stop misleading is to mark it as write only;
--- kernel/sysctl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sysctl.c +1 -1
@@ -1126,7 +1126,7 @@ static struct ctl_table vm_table[] = { .procname = "drop_caches", .data = &sysctl_drop_caches, .maxlen = sizeof(int), - .mode = 0644, + .mode = 0200, .proc_handler = drop_caches_sysctl_handler, },#ifdef CONFIG_COMPACTION
Signature · 1 line
1.7.0.4