* [PATCH v2 2/3] mm/slab: Sharing s_next and s_stop between slab and slub
2013-06-27 0:41 [PATCH v2 1/3] mm/slab: Fix drain freelist excessively Wanpeng Li
@ 2013-06-27 0:41 ` Wanpeng Li
2013-06-27 0:41 ` [PATCH v2 3/3] mm/slab: Fix /proc/slabinfo unwriteable for slab Wanpeng Li
2013-07-01 15:50 ` [PATCH v2 1/3] mm/slab: Fix drain freelist excessively Christoph Lameter
2 siblings, 0 replies; 5+ messages in thread
From: Wanpeng Li @ 2013-06-27 0:41 UTC (permalink / raw)
To: Pekka Enberg, Christoph Lameter, Matt Mackall
Cc: Glauber Costa, Andrew Morton, Joonsoo Kim, David Rientjes,
lllllinux-mm, linux-kernel, Wanpeng Li
Changelog:
v1 -> v2:
* give these slab-specific names instead of exporting "s_next" and "s_stop"
This patch shares s_next and s_stop between slab and slub.
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
mm/slab.c | 10 ----------
mm/slab.h | 3 +++
mm/slab_common.c | 8 ++++----
3 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index f58eb0b..f3f454ad 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4431,16 +4431,6 @@ static int leaks_show(struct seq_file *m, void *p)
return 0;
}
-static void *s_next(struct seq_file *m, void *p, loff_t *pos)
-{
- return seq_list_next(p, &slab_caches, pos);
-}
-
-static void s_stop(struct seq_file *m, void *p)
-{
- mutex_unlock(&slab_mutex);
-}
-
static const struct seq_operations slabstats_op = {
.start = leaks_start,
.next = s_next,
diff --git a/mm/slab.h b/mm/slab.h
index f96b49e..620ceed 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -271,3 +271,6 @@ struct kmem_cache_node {
#endif
};
+
+void *slab_next(struct seq_file *m, void *p, loff_t *pos);
+void slab_stop(struct seq_file *m, void *p);
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 2d41450..4ee4325 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -531,12 +531,12 @@ static void *s_start(struct seq_file *m, loff_t *pos)
return seq_list_start(&slab_caches, *pos);
}
-static void *s_next(struct seq_file *m, void *p, loff_t *pos)
+void *slab_next(struct seq_file *m, void *p, loff_t *pos)
{
return seq_list_next(p, &slab_caches, pos);
}
-static void s_stop(struct seq_file *m, void *p)
+void slab_stop(struct seq_file *m, void *p)
{
mutex_unlock(&slab_mutex);
}
@@ -613,8 +613,8 @@ static int s_show(struct seq_file *m, void *p)
*/
static const struct seq_operations slabinfo_op = {
.start = s_start,
- .next = s_next,
- .stop = s_stop,
+ .next = slab_next,
+ .stop = slab_stop,
.show = s_show,
};
--
1.8.1.2
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v2 3/3] mm/slab: Fix /proc/slabinfo unwriteable for slab
2013-06-27 0:41 [PATCH v2 1/3] mm/slab: Fix drain freelist excessively Wanpeng Li
2013-06-27 0:41 ` [PATCH v2 2/3] mm/slab: Sharing s_next and s_stop between slab and slub Wanpeng Li
@ 2013-06-27 0:41 ` Wanpeng Li
2013-07-01 15:51 ` Christoph Lameter
2013-07-01 15:50 ` [PATCH v2 1/3] mm/slab: Fix drain freelist excessively Christoph Lameter
2 siblings, 1 reply; 5+ messages in thread
From: Wanpeng Li @ 2013-06-27 0:41 UTC (permalink / raw)
To: Pekka Enberg, Christoph Lameter, Matt Mackall
Cc: Glauber Costa, Andrew Morton, Joonsoo Kim, David Rientjes,
lllllinux-mm, linux-kernel, Wanpeng Li
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, 10 insertions(+)
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 4ee4325..d41ff76 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -631,10 +631,20 @@ static const struct file_operations proc_slabinfo_operations = {
.release = seq_release,
};
+#ifdef CONFIG_SLAB
+static int __init slab_proc_init(void)
+{
+ proc_create("slabinfo", S_IWUSR | S_IRUSR, NULL, &proc_slabinfo_operations);
+ return 0;
+}
+#endif
+#ifdef CONFIG_SLUB
static int __init slab_proc_init(void)
{
proc_create("slabinfo", S_IRUSR, NULL, &proc_slabinfo_operations);
return 0;
}
+#endif
+
module_init(slab_proc_init);
#endif /* CONFIG_SLABINFO */
--
1.8.1.2
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2 1/3] mm/slab: Fix drain freelist excessively
2013-06-27 0:41 [PATCH v2 1/3] mm/slab: Fix drain freelist excessively Wanpeng Li
2013-06-27 0:41 ` [PATCH v2 2/3] mm/slab: Sharing s_next and s_stop between slab and slub Wanpeng Li
2013-06-27 0:41 ` [PATCH v2 3/3] mm/slab: Fix /proc/slabinfo unwriteable for slab Wanpeng Li
@ 2013-07-01 15:50 ` Christoph Lameter
2 siblings, 0 replies; 5+ messages in thread
From: Christoph Lameter @ 2013-07-01 15:50 UTC (permalink / raw)
To: Wanpeng Li
Cc: Pekka Enberg, Matt Mackall, Glauber Costa, Andrew Morton,
Joonsoo Kim, David Rientjes, lllllinux-mm, linux-kernel
On Thu, 27 Jun 2013, Wanpeng Li wrote:
> The drain_freelist is called to drain slabs_free lists for cache reap,
> cache shrink, memory hotplug callback etc. The tofree parameter is the
> number of slab objects to free instead of the number of slabs to free.
> The parameter transfered from callers is n->free_objects or n->freelimit
> + 5 * (searchp->num - 1) / (5 * searchp->num), and both of them mean
> the number of slabs objects. I add printk to dump drain information:
See my reply to V1.
^ permalink raw reply [flat|nested] 5+ messages in thread