@@ -39,6 +39,8 @@
#include "internal.h"
+#define SLAB_NO_RED_LEFT 0x10000000UL
+
/*
* Lock order:
* 1. slab_mutex (Global Mutex)
@@ -1230,6 +1232,9 @@ static int __init setup_slub_debug(char *str)
case 'a':
slub_debug |= SLAB_FAILSLAB;
break;
+ case 'x':
+ slub_debug |= SLAB_NO_RED_LEFT;
+ break;
case 'o':
/*
* Avoid enabling debugging on caches if its minimum
@@ -3320,11 +3325,11 @@ static int calculate_sizes(struct kmem_cache
*s, int forced_order)
* corrupted if a user writes before the start
* of the object.
*/
- size += sizeof(void *);
-
- s->red_left_pad = sizeof(void *);
- s->red_left_pad = ALIGN(s->red_left_pad, s->align);
- size += s->red_left_pad;
+ size += ALIGN(sizeof(void *), s->align);
+ if (flags & SLAB_NO_RED_LEFT)
+ s->red_left_pad = 0;
+ else
+ s->red_left_pad = ALIGN(sizeof(void *), s->align);
}
#endif