diff options
| author | Vlastimil Babka <[email protected]> | 2022-11-15 18:14:31 +0100 |
|---|---|---|
| committer | Vlastimil Babka <[email protected]> | 2022-12-01 00:09:09 +0100 |
| commit | 0af8489b0216fa1dd83e264bef8063f2632633d7 (patch) | |
| tree | 704e42a5423c994b0e8c179c9e5cf9da191e0386 /include/linux | |
| parent | 56d5a2b9ba85a390473e86b4fe4697560242a248 (diff) | |
mm, slub: remove percpu slabs with CONFIG_SLUB_TINY
SLUB gets most of its scalability by percpu slabs. However for
CONFIG_SLUB_TINY the goal is minimal memory overhead, not scalability.
Thus, #ifdef out the whole kmem_cache_cpu percpu structure and
associated code. Additionally to the slab page savings, this reduces
percpu allocator usage, and code size.
This change builds on recent commit c7323a5ad078 ("mm/slub: restrict
sysfs validation to debug caches and make it safe"), as caches with
enabled debugging also avoid percpu slabs and all allocations and
freeing ends up working with the partial list. With a bit more
refactoring by the preceding patches, use the same code paths with
CONFIG_SLUB_TINY.
Signed-off-by: Vlastimil Babka <[email protected]>
Acked-by: Mike Rapoport <[email protected]>
Reviewed-by: Christoph Lameter <[email protected]>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/slub_def.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 95b67863d5cf..aa0ee1678d29 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h @@ -41,6 +41,7 @@ enum stat_item { CPU_PARTIAL_DRAIN, /* Drain cpu partial to node partial */ NR_SLUB_STAT_ITEMS }; +#ifndef CONFIG_SLUB_TINY /* * When changing the layout, make sure freelist and tid are still compatible * with this_cpu_cmpxchg_double() alignment requirements. @@ -57,6 +58,7 @@ struct kmem_cache_cpu { unsigned stat[NR_SLUB_STAT_ITEMS]; #endif }; +#endif /* CONFIG_SLUB_TINY */ #ifdef CONFIG_SLUB_CPU_PARTIAL #define slub_percpu_partial(c) ((c)->partial) @@ -88,7 +90,9 @@ struct kmem_cache_order_objects { * Slab cache management. */ struct kmem_cache { +#ifndef CONFIG_SLUB_TINY struct kmem_cache_cpu __percpu *cpu_slab; +#endif /* Used for retrieving partial slabs, etc. */ slab_flags_t flags; unsigned long min_partial; |