lkml.org 
[lkml]   [2011]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: slub: Fix per cpu partial statistics
On Mon, 12 Dec 2011, Pekka Enberg 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@linux.com>
> >
> > ---
> > 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

This was already fixed up by "slub: avoid potential NULL dereference or
corruption" in slab/next, so I suggest dropping this hunk.

> > @@ -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?
>

I thought page->pages would be better?


\
 
 \ /
  Last update: 2011-12-15 04:07    [W:0.072 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site