[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1111221340320.30368@router.home>
Date: Tue, 22 Nov 2011 13:46:11 -0600 (CST)
From: Christoph Lameter <cl@...ux.com>
To: Markus Trippelsdorf <markus@...ppelsdorf.de>
cc: Eric Dumazet <eric.dumazet@...il.com>,
Christian Kujau <lists@...dbynature.de>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
"Alex,Shi" <alex.shi@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Pekka Enberg <penberg@...nel.org>,
Matt Mackall <mpm@...enic.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Tejun Heo <tj@...nel.org>
Subject: Re: slub: Lockout validation scans during freeing of object
On Tue, 22 Nov 2011, Markus Trippelsdorf wrote:
> > Could you get me the value of the "slabs" field for the slabs showing the
> > wierd values. I.e. do
> >
> > cat /sys/kernel/slab/signal_cache/slabs
> >
> > > signal_cache 268 920 360.4K 18446744073709551614/7/24 17 2 31 68 A
> >
>
> It's quite easy to explain. You're using unsigned ints in:
> snprintf(dist_str, 40, "%lu/%lu/%d", s->slabs - s->cpu_slabs, s->partial, s->cpu_slabs);
>
> and (s->slabs - s->cpu_slabs) can get negative. For example:
>
> task_struct 269 1504 557.0K 18446744073709551601/5/32 21 3 29 72
>
> Here s-slabs is 17 and s->cpu_slabs is 32.
> That gives: 17-32=18446744073709551601.
s->cpu_slabs includes the number of per cpu partial slabs since 3.2. And
that calculation is broken it seems. It adds up the number of objects instead
of the number of slab pages.
So much for review and having that stuff in -next for a long time. Sigh.
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 not the number of objects in the partial slabs.
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@...ux.com>
---
mm/slub.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 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:43:56.000000000 -0600
@@ -4451,7 +4451,7 @@ static ssize_t show_slab_objects(struct
continue;
if (c->page) {
- if (flags & SO_TOTAL)
+ if (flags & SO_TOTAL)
x = c->page->objects;
else if (flags & SO_OBJECTS)
x = c->page->inuse;
@@ -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;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists