Merge tag 'core-urgent-2021-05-15' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / mm / slab_common.c
index 4c6107e..a4a5714 100644 (file)
@@ -71,11 +71,19 @@ static int __init setup_slab_nomerge(char *str)
        return 1;
 }
 
+static int __init setup_slab_merge(char *str)
+{
+       slab_nomerge = false;
+       return 1;
+}
+
 #ifdef CONFIG_SLUB
 __setup_param("slub_nomerge", slub_nomerge, setup_slab_nomerge, 0);
+__setup_param("slub_merge", slub_merge, setup_slab_merge, 0);
 #endif
 
 __setup("slab_nomerge", setup_slab_nomerge);
+__setup("slab_merge", setup_slab_merge);
 
 /*
  * Determine the size of a slab object
@@ -310,6 +318,16 @@ kmem_cache_create_usercopy(const char *name,
        const char *cache_name;
        int err;
 
+#ifdef CONFIG_SLUB_DEBUG
+       /*
+        * If no slub_debug was enabled globally, the static key is not yet
+        * enabled by setup_slub_debug(). Enable it if the cache is being
+        * created with any of the debugging flags passed explicitly.
+        */
+       if (flags & SLAB_DEBUG_FLAGS)
+               static_branch_enable(&slub_debug_enabled);
+#endif
+
        mutex_lock(&slab_mutex);
 
        err = kmem_cache_sanity_check(name, size);