Re: [QUESTION] is SLAB considered legacy and deprecated?

From: David Rientjes
Date: Sun Oct 03 2021 - 21:27:52 EST


On Sun, 3 Oct 2021, Hyeonggon Yoo wrote:

> I think the points are still valid because on some workloads SLAB works
> better. especially when alloc/frees are intensive, SLUB tends to become
> bottleneck.
>
> If we can't drop SLAB, it should be at least maintained :(
> But it has been neglected for a long time, which makes people not to
> use SLAB. Nobody likes to use a subsystem that isn't maintained.
>
> Anyway, I'm curious about share of SLAB and SLUB and on what situations
> SLAB or SLUB is preferred. that information would help maintain both.
>

Thanks for raising this, the discussion is always useful. Both allocators
have their pros and cons.

I would disagree that SLAB isn't currently maintained, I think it's
actively maintained. Google actually uses it for its production kernel
although we're investigating the performance results that we can obtain
from SLUB not that we have per-object memcg accounting. There have been
workloads, as you mention, that perform better with SLAB even though SLUB
can make up for some of its degradation by throwing more memory at the
problem (like per-cpu partial slabs).

I think the general guidance is that changes for both allocators can still
be merged upstream if they show a significant win (improved performnace,
maintaining performance while reducing memory footprint, code hygiene,
etc) and there's no specific policy that we cannot make changes to
mm/slab.c.