P               Poisoning (object and padding)
        U               User tracking (free and alloc)
        T               Trace (please only use on single slabs)
+       O               Switch debugging off for caches that would have
+                       caused higher minimum slab orders
        -               Switch all debugging off (useful if the kernel is
                        configured with CONFIG_SLUB_DEBUG_ON)
 
 
        slub_debug=F,dentry
 
+Debugging options may require the minimum possible slab order to increase as
+a result of storing the metadata (for example, caches with PAGE_SIZE object
+sizes).  This has a higher liklihood of resulting in slab allocation errors
+in low memory situations or if there's high fragmentation of memory.  To
+switch off debugging for such caches by default, use
+
+       slub_debug=O
+
 In case you forgot to enable debugging on the kernel command line: It is
 possible to enable debugging manually when the kernel is up. Look at the
 contents of:
 
 #define DEBUG_DEFAULT_FLAGS (SLAB_DEBUG_FREE | SLAB_RED_ZONE | \
                                SLAB_POISON | SLAB_STORE_USER)
 
+/*
+ * Debugging flags that require metadata to be stored in the slab, up to
+ * DEBUG_SIZE in size.
+ */
+#define DEBUG_SIZE_FLAGS (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER)
+#define DEBUG_SIZE (3 * sizeof(void *) + 2 * sizeof(struct track))
+
 /*
  * Set of flags that will prevent slab merging
  */
 #endif
 
 static char *slub_debug_slabs;
+static int disable_higher_order_debug;
 
 /*
  * Object debugging
                 */
                goto check_slabs;
 
+       if (tolower(*str) == 'o') {
+               /*
+                * Avoid enabling debugging on caches if its minimum order
+                * would increase as a result.
+                */
+               disable_higher_order_debug = 1;
+               goto out;
+       }
+
        slub_debug = 0;
        if (*str == '-')
                /*
        unsigned long flags, const char *name,
        void (*ctor)(void *))
 {
+       int debug_flags = slub_debug;
+
        /*
         * Enable debugging if selected on the kernel commandline.
         */
-       if (slub_debug && (!slub_debug_slabs ||
-           strncmp(slub_debug_slabs, name, strlen(slub_debug_slabs)) == 0))
-                       flags |= slub_debug;
+       if (debug_flags) {
+               if (slub_debug_slabs &&
+                   strncmp(slub_debug_slabs, name, strlen(slub_debug_slabs)))
+                       goto out;
+
+               /*
+                * Disable debugging that increases slab size if the minimum
+                * slab order would have increased as a result.
+                */
+               if (disable_higher_order_debug &&
+                   get_order(objsize + DEBUG_SIZE) > get_order(objsize))
+                       debug_flags &= ~DEBUG_SIZE_FLAGS;
 
+               flags |= debug_flags;
+       }
+out:
        return flags;
 }
 #else
                "default order: %d, min order: %d\n", s->name, s->objsize,
                s->size, oo_order(s->oo), oo_order(s->min));
 
+       if (oo_order(s->min) > get_order(s->objsize))
+               printk(KERN_WARNING "  %s debugging increased min order, use "
+                      "slub_debug=O to disable.\n", s->name);
+
        for_each_online_node(node) {
                struct kmem_cache_node *n = get_node(s, node);
                unsigned long nr_slabs;