Thread (16 messages) 16 messages, 4 authors, 2021-10-05

Re: Queueing is outside of SLUB nowdays

From: Vlastimil Babka <hidden>
Date: 2021-10-05 08:19:37
Also in: lkml

On 10/4/21 16:56, Christoph Lameter wrote:
On Fri, 1 Oct 2021, Hyeonggon Yoo wrote:
quoted
Looking at other layers, they implemented queuing layer outside of SLUB.
See commit 795bb1c00dd ("net: bulk free infrastructure for NAPI context,
use napi_consume_skb") for example. They made skb cache because SLUB is
not suitable for intensive alloc/free.

And because the queue is outside of slab, it can go lockless
depending on it's context. (But it's not easy to do so in slab because
slab is general purpose allocator.)
The queuing within in SLUB/SLAB is lockless.
quoted
So current approach on place where slab's performance is critical
is implementing queuing layer on top of slab.
If you have to use object specific characteristics to optimize then yes
you can optimize further. However, the slab allocators implement each
their own form of queuing that is generic.
quoted
Then new question arising:
    - Is that proper way to solve fundamental problem?
There is a problem?
If someone benefits from implementing a caching layer on top of SL*B, it
probably indicates a problem.
quoted
      - why not use SLAB if they need queuing?
SLAB is LIFO queuing whereas SLUB uses spatial considerations and queues
within a page before going outside.
IIUC SLUB queueing works well for allocation (we just consume a per-cpu
freelist that nobody else can touch) but freeing uses the corresponding
page's freelist so the atomics are more expensive. In both cases the linked
freelists might be also worse for cache locality than an array of pointers.
So perhaps some workload still benefit from a array-based cache on top of
SLUB and it would be great if they didn't have to implement own solutions?
Slab requires disabling interrupts,
SLUB is optimized to rely on per cpu atomics and there are numerous other
differences.
quoted
      - how does this approach work on SLAB?
SLAB has a lockless layer that is only requiring disabling interrupts. It
provides a generic queuing layer as well.

See my talk on Slab allocators awhile back.

https://www.youtube.com/watch?v=h0VMLXavx30
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help