Re: slub: Fix per cpu partial statistics

From: Pekka Enberg
Date: Mon Dec 12 2011 - 02:14:39 EST


On Wed, 23 Nov 2011, Christoph Lameter wrote:
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;
}


Looks OK to me. David, Eric?

Pekka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/