Skip to content

SLUB: Implement mostly lockless slowpaths

Christoph Lameter linux-mm 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest19 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19percpu: Fixup __this_cpu_xchg* operationsarch/x86/include/asm/percpu.h+6 -60 replies
2/19slub: get_map() function to establish map of free objects in a slabmm/slub.c+22 -120 replies
3/19slub: Eliminate repeated use of c->page through a new page variablemm/slub.c+22 -190 replies
4/19slub: Move node determination out of hotpathmm/slub.c+5 -40 replies
5/19slub: Move debug handlign in __slab_freemm/slub.c+2 -90 replies
6/19slub: Do not use frozen page flag but a bit in the page countersinclude/linux/mm_types.h include/linux/page-flags.h mm/slub.c+9 -100 replies
7/19slub: Move page->frozen handling near where the page->freelist handling occursmm/slub.c+6 -30 replies
8/19x86: Add support for cmpxchg_doublearch/x86/Kconfig.cpu arch/x86/include/asm/cmpxchg_32.h arch/x86/include/asm/cmpxchg_64.h+92 -00 replies
9/19mm: Rearrange struct pageinclude/linux/mm_types.h+55 -300 replies
10/19slub: Add cmpxchg_double_slab()include/linux/slub_def.h mm/slub.c+39 -00 replies
11/19slub: explicit list_lock takingmm/slub.c+36 -380 replies
12/19slub: Pass kmem_cache struct to lock and freeze slabmm/slub.c+7 -60 replies
13/19slub: Rework allocator fastpathsmm/slub.c+292 -1300 replies
14/19slub: Invert locking and avoid slab lockmm/slub.c+52 -780 replies
15/19slub: Disable interrupts in free_debug processingmm/slub.c+6 -00 replies
16/19slub: Avoid disabling interrupts in free slowpathmm/slub.c+12 -110 replies
17/19slub: Get rid of the another_slab labelmm/slub.c+5 -60 replies
18/19slub: fast release on full slabmm/slub.c+16 -20 replies
19/19slub: Not necessary to check for empty slab on load_freelistmm/slub.c+2 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [slubll1 00/19] SLUB: Implement mostly lockless slowpaths

Well here is another result of my obsession with SLAB allocators. There must be some way to get an allocator done that is faster without queueing and I hope that we are now there (maybe only almost...).

This patchset implement wider lockless operations in slub affecting most of the slowpaths. In particular the patch decreases the overhead in the performance critical section of __slab_free.

One test that I ran was "hackbench 200 process 200" on 2.6.29-rc1 under KVM

Run SLAB SLUB SLUB LL
1st 35.2 35.9 31.9
2nd 34.6 30.8 27.9
3rd 33.8 29.9 28.8

Note that the SLUB version in 2.6.29-rc1 already has an optimized allocation and free path using this_cpu_cmpxchg_double(). SLUB LL takes it to new heights by also using cmpxchg_double() in the slowpaths (especially in the kfree() case where we cannot queue).

The patch uses a cmpxchg_double (also introduced here) to do an atomic change on the state of a slab page that includes the following pieces of information:

1. Freelist pointer
2. Number of objects inuse
3. Frozen state of a slab

Disabling of interrupts (which is a significant latency in the allocator paths) is avoided in the __slab_free case.

There are some concerns with this patch. The use of cmpxchg_double on fields of the page struct requires alignment of the fields to double word boundaries. That can only be accomplished by adding some padding to struct page which blows it up to 64 byte (on x86_64). Comments in the source describe these things in more detail.

The cmpxchg_double() operation introduced here could also be used to update other doublewords in the page struct in a lockless fashone. One can envision page state changes that involved flags and mappings or do list operations locklessly.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>