[PATCH 1/6] mm/slub: add total_objects_partial sysfs

From: Wei Yang
Date: Wed May 17 2017 - 10:12:55 EST


For partial slabs, show_slab_objects could display its total objects.

This patch just adds an entry to display it.

Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
---
mm/slub.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/mm/slub.c b/mm/slub.c
index a7a109247730..1100d2e75870 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4983,6 +4983,12 @@ static ssize_t objects_partial_show(struct kmem_cache *s, char *buf)
}
SLAB_ATTR_RO(objects_partial);

+static ssize_t total_objects_partial_show(struct kmem_cache *s, char *buf)
+{
+ return show_slab_objects(s, buf, SO_PARTIAL|SO_TOTAL);
+}
+SLAB_ATTR_RO(total_objects_partial);
+
static ssize_t slabs_cpu_partial_show(struct kmem_cache *s, char *buf)
{
int objects = 0;
@@ -5359,6 +5365,7 @@ static struct attribute *slab_attrs[] = {
&cpu_partial_attr.attr,
&objects_attr.attr,
&objects_partial_attr.attr,
+ &total_objects_partial_attr.attr,
&partial_attr.attr,
&cpu_slabs_attr.attr,
&ctor_attr.attr,
--
2.11.0