diff --git a/mm/slub.c b/mm/slub.c index 3e5aefcb4075..238c5a6ee896 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2435,6 +2435,7 @@ void __init kmem_cache_init(void) */ create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node", sizeof(struct kmem_cache_node), GFP_KERNEL); + kmalloc_caches[0].refcount = -1; #endif /* Able to allocate the per node structures */ @@ -2482,6 +2483,12 @@ static int slab_unmergeable(struct kmem_cache *s) if (s->ctor) return 1; + /* + * We may have set a slab to be unmergeable during bootstrap. + */ + if (s->refcount < 0) + return 1; + return 0; }