summaryrefslogtreecommitdiffstats
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2019-11-30 17:56:08 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-04 13:59:57 +0100
commit5dc89b665d7278a50997a081ae546115029b2282 (patch)
tree6e8162c6465c592aa4bc5dce6793025b11ae33ab /kernel/sysctl.c
parent9c2f6b5e695f78dfc8dde991c2a23276f5b7041d (diff)
downloadlinux-stable-5dc89b665d7278a50997a081ae546115029b2282.tar.gz
linux-stable-5dc89b665d7278a50997a081ae546115029b2282.tar.bz2
linux-stable-5dc89b665d7278a50997a081ae546115029b2282.zip
kernel: sysctl: make drop_caches write-only
[ Upstream commit 204cb79ad42f015312a5bbd7012d09c93d9b46fb ] Currently, the drop_caches proc file and sysctl read back the last value written, suggesting this is somehow a stateful setting instead of a one-time command. Make it write-only, like e.g. compact_memory. While mitigating a VM problem at scale in our fleet, there was confusion about whether writing to this file will permanently switch the kernel into a non-caching mode. This influences the decision making in a tense situation, where tens of people are trying to fix tens of thousands of affected machines: Do we need a rollback strategy? What are the performance implications of operating in a non-caching state for several days? It also caused confusion when the kernel team said we may need to write the file several times to make sure it's effective ("But it already reads back 3?"). Link: http://lkml.kernel.org/r/20191031221602.9375-1-hannes@cmpxchg.org Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Chris Down <chris@chrisdown.name> Acked-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: David Hildenbrand <david@redhat.com> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index cfc2c0d1369a..74fc3a9d1923 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1397,7 +1397,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,
.extra1 = &one,
.extra2 = &four,