[PATCH 3/6] mm/slub: add cpu_slabs_[total_]objects sysfs
From: Wei Yang
Date: Wed May 17 2017 - 10:13:41 EST
For cpu slabs, show_slab_objects could display statistics for objects.
This patch just adds an entry to reflect it.
Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
---
mm/slub.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/mm/slub.c b/mm/slub.c
index c7dddf22829d..f2f751e6cb96 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4958,6 +4958,18 @@ static ssize_t cpu_slabs_show(struct kmem_cache *s, char *buf)
}
SLAB_ATTR_RO(cpu_slabs);
+static ssize_t cpu_slabs_objects_show(struct kmem_cache *s, char *buf)
+{
+ return show_slab_objects(s, buf, SO_CPU|SO_OBJECTS);
+}
+SLAB_ATTR_RO(cpu_slabs_objects);
+
+static ssize_t cpu_slabs_total_objects_show(struct kmem_cache *s, char *buf)
+{
+ return show_slab_objects(s, buf, SO_CPU|SO_TOTAL);
+}
+SLAB_ATTR_RO(cpu_slabs_total_objects);
+
static ssize_t objects_show(struct kmem_cache *s, char *buf)
{
return show_slab_objects(s, buf, SO_ALL|SO_OBJECTS);
@@ -5354,6 +5366,8 @@ static struct attribute *slab_attrs[] = {
&objects_partial_attr.attr,
&total_objects_partial_attr.attr,
&partial_attr.attr,
+ &cpu_slabs_objects_attr.attr,
+ &cpu_slabs_total_objects_attr.attr,
&cpu_slabs_attr.attr,
&ctor_attr.attr,
&aliases_attr.attr,
--
2.11.0