All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wanpeng Li <liwanp@linux.vnet.ibm.com>
To: Pekka Enberg <penberg@kernel.org>,
	Christoph Lameter <cl@linux-foundation.org>,
	Matt Mackall <mpm@selenic.com>
Cc: Glauber Costa <glommer@parallels.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Joonsoo Kim <js1304@gmail.com>,
	David Rientjes <rientjes@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Wanpeng Li <liwanp@linux.vnet.ibm.com>
Subject: [PATCH v2 3/5] mm/slab: Fix /proc/slabinfo unwriteable for slab
Date: Wed,  3 Jul 2013 08:49:51 +0800	[thread overview]
Message-ID: <1372812593-7617-3-git-send-email-liwanp@linux.vnet.ibm.com> (raw)
In-Reply-To: <1372812593-7617-1-git-send-email-liwanp@linux.vnet.ibm.com>

Slab have some tunables like limit, batchcount, and sharedfactor can be
tuned through function slabinfo_write. Commit (b7454ad3: mm/sl[au]b: Move
slabinfo processing to slab_common.c) uncorrectly change /proc/slabinfo
unwriteable for slab, this patch fix it by revert to original mode.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 mm/slab_common.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/mm/slab_common.c b/mm/slab_common.c
index d161b81..6a5deda 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -497,6 +497,13 @@ void __init create_kmalloc_caches(unsigned long flags)
 
 
 #ifdef CONFIG_SLABINFO
+
+#ifdef CONFIG_SLAB
+#define SLABINFO_RIGHTS (S_IWUSR | S_IRUSR)
+#else
+#define SLABINFO_RIGHTS S_IRUSR
+#endif
+
 void print_slabinfo_header(struct seq_file *m)
 {
 	/*
@@ -633,7 +640,8 @@ static const struct file_operations proc_slabinfo_operations = {
 
 static int __init slab_proc_init(void)
 {
-	proc_create("slabinfo", S_IRUSR, NULL, &proc_slabinfo_operations);
+	proc_create("slabinfo", SLABINFO_RIGHTS, NULL,
+						&proc_slabinfo_operations);
 	return 0;
 }
 module_init(slab_proc_init);
-- 
1.8.1.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Wanpeng Li <liwanp@linux.vnet.ibm.com>
To: Pekka Enberg <penberg@kernel.org>,
	Christoph Lameter <cl@linux-foundation.org>,
	Matt Mackall <mpm@selenic.com>
Cc: Glauber Costa <glommer@parallels.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Joonsoo Kim <js1304@gmail.com>,
	David Rientjes <rientjes@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Wanpeng Li <liwanp@linux.vnet.ibm.com>
Subject: [PATCH v2 3/5] mm/slab: Fix /proc/slabinfo unwriteable for slab
Date: Wed,  3 Jul 2013 08:49:51 +0800	[thread overview]
Message-ID: <1372812593-7617-3-git-send-email-liwanp@linux.vnet.ibm.com> (raw)
In-Reply-To: <1372812593-7617-1-git-send-email-liwanp@linux.vnet.ibm.com>

Slab have some tunables like limit, batchcount, and sharedfactor can be
tuned through function slabinfo_write. Commit (b7454ad3: mm/sl[au]b: Move
slabinfo processing to slab_common.c) uncorrectly change /proc/slabinfo
unwriteable for slab, this patch fix it by revert to original mode.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 mm/slab_common.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/mm/slab_common.c b/mm/slab_common.c
index d161b81..6a5deda 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -497,6 +497,13 @@ void __init create_kmalloc_caches(unsigned long flags)
 
 
 #ifdef CONFIG_SLABINFO
+
+#ifdef CONFIG_SLAB
+#define SLABINFO_RIGHTS (S_IWUSR | S_IRUSR)
+#else
+#define SLABINFO_RIGHTS S_IRUSR
+#endif
+
 void print_slabinfo_header(struct seq_file *m)
 {
 	/*
@@ -633,7 +640,8 @@ static const struct file_operations proc_slabinfo_operations = {
 
 static int __init slab_proc_init(void)
 {
-	proc_create("slabinfo", S_IRUSR, NULL, &proc_slabinfo_operations);
+	proc_create("slabinfo", SLABINFO_RIGHTS, NULL,
+						&proc_slabinfo_operations);
 	return 0;
 }
 module_init(slab_proc_init);
-- 
1.8.1.2


  parent reply	other threads:[~2013-07-03  0:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-03  0:49 [PATCH v2 1/5] mm/slab: Fix drain freelist excessively Wanpeng Li
2013-07-03  0:49 ` Wanpeng Li
2013-07-03  0:49 ` [PATCH v2 2/5] mm/slab: Sharing s_next and s_stop between slab and slub Wanpeng Li
2013-07-03  0:49   ` Wanpeng Li
2013-07-03 13:54   ` Christoph Lameter
2013-07-03 13:54     ` Christoph Lameter
2013-07-03  0:49 ` Wanpeng Li [this message]
2013-07-03  0:49   ` [PATCH v2 3/5] mm/slab: Fix /proc/slabinfo unwriteable for slab Wanpeng Li
2013-07-03 13:55   ` Christoph Lameter
2013-07-03 13:55     ` Christoph Lameter
2013-07-03  0:49 ` [PATCH v2 4/5] mm/slub: Drop unnecessary nr_partials Wanpeng Li
2013-07-03  0:49   ` Wanpeng Li
2013-07-03 13:59   ` Christoph Lameter
2013-07-03 13:59     ` Christoph Lameter
2013-07-03  0:49 ` [PATCH v2 5/5] mm/slub: Use node_nr_slabs and node_nr_objs in get_slabinfo Wanpeng Li
2013-07-03  0:49   ` Wanpeng Li
2013-07-03 13:54 ` [PATCH v2 1/5] mm/slab: Fix drain freelist excessively Christoph Lameter
2013-07-03 13:54   ` Christoph Lameter
2013-07-03 23:29   ` Wanpeng Li
2013-07-03 23:29   ` Wanpeng Li

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=1372812593-7617-3-git-send-email-liwanp@linux.vnet.ibm.com \
    --to=liwanp@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=glommer@parallels.com \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.