From: Nikanth Karthikesan <knikanth@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Make /proc/sys/vm/drop_caches write only
Date: Thu, 13 Nov 2008 17:54:11 +0530 [thread overview]
Message-ID: <200811131754.11863.knikanth@suse.de> (raw)
/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,
},
next reply other threads:[~2008-11-13 12:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-13 12:24 Nikanth Karthikesan [this message]
2008-11-14 23:07 ` [PATCH] Make /proc/sys/vm/drop_caches write only Andrew Morton
2008-11-17 6:27 ` Nikanth Karthikesan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200811131754.11863.knikanth@suse.de \
--to=knikanth@suse.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox