Re: [PATCH v2 2/2] SLUB: Mark merged slab caches in /proc/slabinfo

Linus Torvalds
2010-09-16T17:49:32Z

On Thu, Sep 16, 2010 at 10:39 AM, Christoph Lameter <cl@linux.com> wrote:
>
> The main point of merging slabs is to reduce memory footprint and
> avoid the overhead of managing more slab caches. Performance is a side
> effect that may come about due to a reduced cache footprint if multiple
> caches that are mapped to the same merged cache are used in the same
> context.

The thing is, if we were to be able to separate the _accounting_ from
the allocation, we'd get the best of both worlds.

Maybe slub could have separate 'struct kmem_cache' structures for each
slab, and not merge at that level, but then have a merged _allocator_.
We already have a level of indirection there due to the whole per-cpu
front-end, so maybe it wouldn't even cause any extra pointer chasing.

That would allow slabtop etc to show the number of actual allocations
at the granularity that we want (ie you'd see who is the real user),
but still then use the same slab pages and avoid the slab
fragmentation.

How painful would it be to try to re-organize things like this?
Impossible? Very hard? Or just "need to think about it a bit"?

Linus