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

From: Vlastimil Babka
Date: Mon Sep 27 2021 - 13:03:26 EST


On 9/27/21 11:03, Hyeonggon Yoo wrote:
> Hello there,
>
> I've been working on adding 'lockless cache' on sl[au]b for a while.
> But what it actually does is actually adding 'queuing' on slub.

Yeah, I pointed out those threads from 2011 that called it exactly that...
was there any conclusion why that was not ultimately merged?

> So there is a fundamental question coming into my mind:
> 'is SLAB considered legacy and deprecated?'

To some extend, but not yet in a sense where we would have a deadline to get
rid of it. In some contexts it's still being preferred, AFAIK. But it's okay
if new optional features require just SLUB - for example PREEMPT_RT.

> It seems there are little development on SLAB and people think that
> SLAB is legacy and deprecated, so CONFIG_SLUB is used by default.
>
> But I think both has pros and cons for their own:
> SLAB: more temporal locality (cache friendly)
> but high usage of memory, and less spatial locality (TLB misses) than SLUB.
>
> SLUB: less temporal locality (less cache friendly) than SLAB
> but more spatial locality (TLB hit), and low usage of memory
> and good debugging feature.

I'm not so sure about the usage of memory, SLUB can easily use more I
believe. Instead of caching some arrays of objects it will have one or more
private slabs per cpu, and the slabs are larger-order pages.

> Why do people say SLAB is deprecated/legacy?

Do they?

> Thanks,
> Hyeonggon
>