Re: [RFC/PATCH 2/2] slub: Don't share struct kmem_cache for sharedcaches

From: Christoph Lameter
Date: Mon Apr 25 2011 - 17:08:56 EST


On Mon, 25 Apr 2011, Pekka Enberg wrote:

> On Mon, 25 Apr 2011, Pekka Enberg wrote:
> >> This patch changes the slab cache sharing in SLUB to only share 'struct
> >> kmem_cpu_cache' which contains the actual list of slabs and object freelists.
> >> We no longer share 'struct kmem_cache' between merged caches so /proc/slabinfo
> >> statistics work as expected:
>
> On Mon, Apr 25, 2011 at 10:09 PM, Christoph Lameter <cl@xxxxxxxxx> wrote:
> > I am a bit confused. Struct kmem_cache contains per slab
> > allocation information and all pages have pointers to struct kmem_cache.
> >
> > So we have pages now on the kmem_cache_cpu list with varying kmem_cache
> > pointers? How do we figure out which cache a page belongs to? It seems
> > that a page from one cache can be freed to the freelists of another.
>
> We share the freelist so it goes to the same freelist. However, I
> completely forgot about page to struct kmem_cache mapping so stats
> won't work properly.

How are the freelist shared? You would need to share kmem_cache_node too
to make this work but then you dont have counters per slab anymore.

The counters are in kmem_cache_cpu and kmem_cache_node. So why a
kmem_cache structure for separate stats?

> On Mon, Apr 25, 2011 at 10:09 PM, Christoph Lameter <cl@xxxxxxxxx> wrote:
> > Does this even run right with the debugging enabled?
>
> It boots OK to minimal userspace under KVM with slub_debug. But no, I
> didn't test it properly yet.

Run a validation of all objects please. That should check the slab headers
for correct pointers back.

Also by having multiple kmem_cache * for a single kmem_cache_cpu/node
structure you end up with an elevated cacheline footprint.

--
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/