Subject: slub: Fix per cpu partial statistics
Support for SO_OBJECTS was not properly added to show_slab_objects().
If SO_OBJECTS is not set then the number of slab pages needs to be
returned and not the number of objects in the partial slabs as now.
We do not have that number so just return 1 until we find a better
way to determine that.
Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>
---
mm/slub.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
Index: linux-2.6/mm/slub.c
===================================================================
--- linux-2.6.orig/mm/slub.c 2011-11-22 13:42:23.000000000 -0600
+++ linux-2.6/mm/slub.c 2011-11-22 13:47:52.000000000 -0600
@@ -4451,8 +4451,8 @@ static ssize_t show_slab_objects(struct
continue;
if (c->page) {
- if (flags & SO_TOTAL)
- x = c->page->objects;
+ if (flags & SO_TOTAL)
+ x = c->page->objects;
else if (flags & SO_OBJECTS)
x = c->page->inuse;
else
@@ -4464,7 +4464,11 @@ static ssize_t show_slab_objects(struct
page = c->partial;
if (page) {
- x = page->pobjects;
+ if (flags & SO_OBJECTS)
+ x = page->pobjects;
+ else
+ /* Assume one */
+ x = 1;
total += x;
nodes[c->node] += x;
}