Messages in this thread | ![/](/images/icornerl.gif) | | Date | Wed, 14 Dec 2011 19:05:21 -0800 (PST) | From | David Rientjes <> | Subject | Re: 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?
| ![\](/images/icornerr.gif) |