Skip to content

Commit d30e51a

Browse files
committed
Merge tag 'slab-for-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab
Pull slab updates from Vlastimil Babka: - SLUB: delayed freezing of CPU partial slabs (Chengming Zhou) Freezing is an operation involving double_cmpxchg() that makes a slab exclusive for a particular CPU. Chengming noticed that we use it also in situations where we are not yet installing the slab as the CPU slab, because freezing also indicates that the slab is not on the shared list. This results in redundant freeze/unfreeze operation and can be avoided by marking separately the shared list presence by reusing the PG_workingset flag. This approach neatly avoids the issues described in 9b1ea29 ("Revert "mm, slub: consider rest of partial list if acquire_slab() fails"") as we can now grab a slab from the shared list in a quick and guaranteed way without the cmpxchg_double() operation that amplifies the lock contention and can fail. As a result, lkp has reported 34.2% improvement of stress-ng.rawudp.ops_per_sec - SLAB removal and SLUB cleanups (Vlastimil Babka) The SLAB allocator has been deprecated since 6.5 and nobody has objected so far. We agreed at LSF/MM to wait until the next LTS, which is 6.6, so we should be good to go now. This doesn't yet erase all traces of SLAB outside of mm/ so some dead code, comments or documentation remain, and will be cleaned up gradually (some series are already in the works). Removing the choice of allocators has already allowed to simplify and optimize the code wiring up the kmalloc APIs to the SLUB implementation. * tag 'slab-for-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab: (34 commits) mm/slub: free KFENCE objects in slab_free_hook() mm/slub: handle bulk and single object freeing separately mm/slub: introduce __kmem_cache_free_bulk() without free hooks mm/slub: fix bulk alloc and free stats mm/slub: optimize free fast path code layout mm/slub: optimize alloc fastpath code layout mm/slub: remove slab_alloc() and __kmem_cache_alloc_lru() wrappers mm/slab: move kmalloc() functions from slab_common.c to slub.c mm/slab: move kmalloc_slab() to mm/slab.h mm/slab: move kfree() from slab_common.c to slub.c mm/slab: move struct kmem_cache_node from slab.h to slub.c mm/slab: move memcg related functions from slab.h to slub.c mm/slab: move pre/post-alloc hooks from slab.h to slub.c mm/slab: consolidate includes in the internal mm/slab.h mm/slab: move the rest of slub_def.h to mm/slab.h mm/slab: move struct kmem_cache_cpu declaration to slub.c mm/slab: remove mm/slab.c and slab_def.h mm/mempool/dmapool: remove CONFIG_DEBUG_SLAB ifdefs mm/slab: remove CONFIG_SLAB code from slab common code cpu/hotplug: remove CPUHP_SLAB_PREPARE hooks ...
2 parents 9f8413c + 61d7e36 commit d30e51a

29 files changed

+1094
-5375
lines changed

CREDITS

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
Linus
1010
----------
1111

12-
N: Matt Mackal
13-
E: mpm@selenic.com
14-
D: SLOB slab allocator
15-
1612
N: Matti Aarnio
1713
E: mea@nic.funet.fi
1814
D: Alpha systems hacking, IPv6 and other network related stuff
@@ -1572,6 +1568,10 @@ S: Ampferstr. 50 / 4
15721568
S: 6020 Innsbruck
15731569
S: Austria
15741570

1571+
N: Mark Hemment
1572+
E: markhe@nextd.demon.co.uk
1573+
D: SLAB allocator implementation
1574+
15751575
N: Richard Henderson
15761576
E: rth@twiddle.net
15771577
E: rth@cygnus.com
@@ -2445,6 +2445,10 @@ D: work on suspend-to-ram/disk, killing duplicates from ioctl32,
24452445
D: Altera SoCFPGA and Nokia N900 support.
24462446
S: Czech Republic
24472447

2448+
N: Olivia Mackall
2449+
E: olivia@selenic.com
2450+
D: SLOB slab allocator
2451+
24482452
N: Paul Mackerras
24492453
E: paulus@samba.org
24502454
D: PPP driver

Documentation/core-api/mm-api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The Slab Cache
3737
.. kernel-doc:: include/linux/slab.h
3838
:internal:
3939

40-
.. kernel-doc:: mm/slab.c
40+
.. kernel-doc:: mm/slub.c
4141
:export:
4242

4343
.. kernel-doc:: mm/slab_common.c

arch/arm64/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ config ARM64
154154
select HAVE_MOVE_PUD
155155
select HAVE_PCI
156156
select HAVE_ACPI_APEI if (ACPI && EFI)
157-
select HAVE_ALIGNED_STRUCT_PAGE if SLUB
157+
select HAVE_ALIGNED_STRUCT_PAGE
158158
select HAVE_ARCH_AUDITSYSCALL
159159
select HAVE_ARCH_BITREVERSE
160160
select HAVE_ARCH_COMPILER_H

arch/s390/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ config S390
146146
select GENERIC_TIME_VSYSCALL
147147
select GENERIC_VDSO_TIME_NS
148148
select GENERIC_IOREMAP if PCI
149-
select HAVE_ALIGNED_STRUCT_PAGE if SLUB
149+
select HAVE_ALIGNED_STRUCT_PAGE
150150
select HAVE_ARCH_AUDITSYSCALL
151151
select HAVE_ARCH_JUMP_LABEL
152152
select HAVE_ARCH_JUMP_LABEL_RELATIVE

arch/x86/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ config X86
169169
select HAS_IOPORT
170170
select HAVE_ACPI_APEI if ACPI
171171
select HAVE_ACPI_APEI_NMI if ACPI
172-
select HAVE_ALIGNED_STRUCT_PAGE if SLUB
172+
select HAVE_ALIGNED_STRUCT_PAGE
173173
select HAVE_ARCH_AUDITSYSCALL
174174
select HAVE_ARCH_HUGE_VMAP if X86_64 || X86_PAE
175175
select HAVE_ARCH_HUGE_VMALLOC if X86_64

include/linux/cpuhotplug.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ enum cpuhp_state {
104104
CPUHP_X2APIC_PREPARE,
105105
CPUHP_SMPCFD_PREPARE,
106106
CPUHP_RELAY_PREPARE,
107-
CPUHP_SLAB_PREPARE,
108107
CPUHP_MD_RAID5_PREPARE,
109108
CPUHP_RCUTREE_PREP,
110109
CPUHP_CPUIDLE_COUPLED_PREPARE,

include/linux/slab.h

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
/*
2626
* Flags to pass to kmem_cache_create().
27-
* The ones marked DEBUG are only valid if CONFIG_DEBUG_SLAB is set.
27+
* The ones marked DEBUG need CONFIG_SLUB_DEBUG enabled, otherwise are no-op
2828
*/
2929
/* DEBUG: Perform (expensive) checks on alloc/free */
3030
#define SLAB_CONSISTENCY_CHECKS ((slab_flags_t __force)0x00000100U)
@@ -302,25 +302,15 @@ static inline unsigned int arch_slab_minalign(void)
302302
* Kmalloc array related definitions
303303
*/
304304

305-
#ifdef CONFIG_SLAB
306305
/*
307-
* SLAB and SLUB directly allocates requests fitting in to an order-1 page
306+
* SLUB directly allocates requests fitting in to an order-1 page
308307
* (PAGE_SIZE*2). Larger requests are passed to the page allocator.
309308
*/
310309
#define KMALLOC_SHIFT_HIGH (PAGE_SHIFT + 1)
311310
#define KMALLOC_SHIFT_MAX (MAX_ORDER + PAGE_SHIFT)
312311
#ifndef KMALLOC_SHIFT_LOW
313-
#define KMALLOC_SHIFT_LOW 5
314-
#endif
315-
#endif
316-
317-
#ifdef CONFIG_SLUB
318-
#define KMALLOC_SHIFT_HIGH (PAGE_SHIFT + 1)
319-
#define KMALLOC_SHIFT_MAX (MAX_ORDER + PAGE_SHIFT)
320-
#ifndef KMALLOC_SHIFT_LOW
321312
#define KMALLOC_SHIFT_LOW 3
322313
#endif
323-
#endif
324314

325315
/* Maximum allocatable size */
326316
#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX)
@@ -788,12 +778,4 @@ size_t kmalloc_size_roundup(size_t size);
788778

789779
void __init kmem_cache_init_late(void);
790780

791-
#if defined(CONFIG_SMP) && defined(CONFIG_SLAB)
792-
int slab_prepare_cpu(unsigned int cpu);
793-
int slab_dead_cpu(unsigned int cpu);
794-
#else
795-
#define slab_prepare_cpu NULL
796-
#define slab_dead_cpu NULL
797-
#endif
798-
799781
#endif /* _LINUX_SLAB_H */

include/linux/slab_def.h

Lines changed: 0 additions & 124 deletions
This file was deleted.

0 commit comments

Comments
 (0)