lkml.org 
[lkml]   [2008]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Make /proc/sys/vm/drop_caches write only
Date
 /proc/sys/vm/drop_caches is used only to trigger dropping caches. It does not 
disable the cache. The ability to read the value written to this file long
back gives wrong impression.

Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>

---

diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index 3e5637f..9892e1b 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -66,11 +66,9 @@ int drop_caches_sysctl_handler(ctl_table *table, int write,
struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
{
proc_dointvec_minmax(table, write, file, buffer, length, ppos);
- if (write) {
- if (sysctl_drop_caches & 1)
- drop_pagecache();
- if (sysctl_drop_caches & 2)
- drop_slab();
- }
+ if (sysctl_drop_caches & 1)
+ drop_pagecache();
+ if (sysctl_drop_caches & 2)
+ drop_slab();
return 0;
}
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 9d048fa..dff3c13 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1015,7 +1015,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,
.strategy = &sysctl_intvec,
},


\
 
 \ /
  Last update: 2008-11-13 13:25    [W:0.040 / U:1.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site