The patch titled Subject: mm: memcg/slab: don't create kmalloc-cg caches with cgroup.memory=nokmem has been removed from the -mm tree. Its filename was mm-memcg-slab-create-a-new-set-of-kmalloc-cg-n-caches-fix.patch This patch was dropped because it was folded into mm-memcg-slab-create-a-new-set-of-kmalloc-cg-n-caches.patch ------------------------------------------------------ From: Vlastimil Babka <vbabka@xxxxxxx> Subject: mm: memcg/slab: don't create kmalloc-cg caches with cgroup.memory=nokmem The caches should not be created when kmemcg is disabled on boot, otherwise they are also filled by kmalloc(__GFP_ACCOUNT) allocations. When booted with cgroup.memory=nokmem, link the kmalloc_caches[KMALLOC_CGROUP] entries to KMALLOC_NORMAL entries instead. Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx> Reviewed-by: Shakeel Butt <shakeelb@xxxxxxxxxx> Acked-by: Roman Gushchin <guro@xxxxxx> Acked-by: Waiman Long <longman@xxxxxxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Pekka Enberg <penberg@xxxxxxxxxx> Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/internal.h | 5 +++++ mm/memcontrol.c | 2 +- mm/slab_common.c | 9 +++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) --- a/mm/internal.h~mm-memcg-slab-create-a-new-set-of-kmalloc-cg-n-caches-fix +++ a/mm/internal.h @@ -116,6 +116,11 @@ extern void putback_lru_page(struct page extern pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address); /* + * in mm/memcontrol.c: + */ +extern bool cgroup_memory_nokmem; + +/* * in mm/page_alloc.c */ --- a/mm/memcontrol.c~mm-memcg-slab-create-a-new-set-of-kmalloc-cg-n-caches-fix +++ a/mm/memcontrol.c @@ -83,7 +83,7 @@ DEFINE_PER_CPU(struct mem_cgroup *, int_ static bool cgroup_memory_nosocket; /* Kernel memory accounting disabled? */ -static bool cgroup_memory_nokmem; +bool cgroup_memory_nokmem; /* Whether the swap controller is active */ #ifdef CONFIG_MEMCG_SWAP --- a/mm/slab_common.c~mm-memcg-slab-create-a-new-set-of-kmalloc-cg-n-caches-fix +++ a/mm/slab_common.c @@ -842,10 +842,15 @@ void __init setup_kmalloc_cache_index_ta static void __init new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags) { - if (type == KMALLOC_RECLAIM) + if (type == KMALLOC_RECLAIM) { 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 (cgroup_memory_nokmem) { + kmalloc_caches[type][idx] = kmalloc_caches[KMALLOC_NORMAL][idx]; + return; + } flags |= SLAB_ACCOUNT; + } kmalloc_caches[type][idx] = create_kmalloc_cache( kmalloc_info[idx].name[type], _ Patches currently in -mm which might be from vbabka@xxxxxxx are kunit-make-test-lock-irq-safe.patch mm-memcg-slab-create-a-new-set-of-kmalloc-cg-n-caches.patch mm-slub-use-stackdepot-to-save-stack-trace-in-objects-fix-2.patch