Commit 2f7c1c13 authored by Vlastimil Babka's avatar Vlastimil Babka

mm, slub: don't create kmalloc-rcl caches with CONFIG_SLUB_TINY

Distinguishing kmalloc(__GFP_RECLAIMABLE) can help against fragmentation
by grouping pages by mobility, but on tiny systems the extra memory
overhead of separate set of kmalloc-rcl caches will probably be worse,
and mobility grouping likely disabled anyway.

Thus with CONFIG_SLUB_TINY, don't create kmalloc-rcl caches and use the
regular ones.
Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
Acked-by: default avatarMike Rapoport <rppt@linux.ibm.com>
Reviewed-by: default avatarChristoph Lameter <cl@linux.com>
parent 90ce872c
...@@ -336,12 +336,17 @@ enum kmalloc_cache_type { ...@@ -336,12 +336,17 @@ enum kmalloc_cache_type {
#endif #endif
#ifndef CONFIG_MEMCG_KMEM #ifndef CONFIG_MEMCG_KMEM
KMALLOC_CGROUP = KMALLOC_NORMAL, KMALLOC_CGROUP = KMALLOC_NORMAL,
#else
KMALLOC_CGROUP,
#endif #endif
#ifdef CONFIG_SLUB_TINY
KMALLOC_RECLAIM = KMALLOC_NORMAL,
#else
KMALLOC_RECLAIM, KMALLOC_RECLAIM,
#endif
#ifdef CONFIG_ZONE_DMA #ifdef CONFIG_ZONE_DMA
KMALLOC_DMA, KMALLOC_DMA,
#endif
#ifdef CONFIG_MEMCG_KMEM
KMALLOC_CGROUP,
#endif #endif
NR_KMALLOC_TYPES NR_KMALLOC_TYPES
}; };
......
...@@ -773,10 +773,16 @@ EXPORT_SYMBOL(kmalloc_size_roundup); ...@@ -773,10 +773,16 @@ EXPORT_SYMBOL(kmalloc_size_roundup);
#define KMALLOC_CGROUP_NAME(sz) #define KMALLOC_CGROUP_NAME(sz)
#endif #endif
#ifndef CONFIG_SLUB_TINY
#define KMALLOC_RCL_NAME(sz) .name[KMALLOC_RECLAIM] = "kmalloc-rcl-" #sz,
#else
#define KMALLOC_RCL_NAME(sz)
#endif
#define INIT_KMALLOC_INFO(__size, __short_size) \ #define INIT_KMALLOC_INFO(__size, __short_size) \
{ \ { \
.name[KMALLOC_NORMAL] = "kmalloc-" #__short_size, \ .name[KMALLOC_NORMAL] = "kmalloc-" #__short_size, \
.name[KMALLOC_RECLAIM] = "kmalloc-rcl-" #__short_size, \ KMALLOC_RCL_NAME(__short_size) \
KMALLOC_CGROUP_NAME(__short_size) \ KMALLOC_CGROUP_NAME(__short_size) \
KMALLOC_DMA_NAME(__short_size) \ KMALLOC_DMA_NAME(__short_size) \
.size = __size, \ .size = __size, \
...@@ -862,7 +868,7 @@ void __init setup_kmalloc_cache_index_table(void) ...@@ -862,7 +868,7 @@ void __init setup_kmalloc_cache_index_table(void)
static void __init static void __init
new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags) new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags)
{ {
if (type == KMALLOC_RECLAIM) { if ((KMALLOC_RECLAIM != KMALLOC_NORMAL) && (type == KMALLOC_RECLAIM)) {
flags |= SLAB_RECLAIM_ACCOUNT; flags |= SLAB_RECLAIM_ACCOUNT;
} else if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_CGROUP)) { } else if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_CGROUP)) {
if (mem_cgroup_kmem_disabled()) { if (mem_cgroup_kmem_disabled()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment