浏览代码

slub: Rearrange #ifdef CONFIG_SLUB_DEBUG in calculate_sizes()

Group SLUB_DEBUG code together to reduce the number of #ifdefs. Move some
debug checks under the #ifdef.

Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Christoph Lameter 17 年之前
父节点
当前提交
d8b42bf54b
共有 1 个文件被更改,包括 8 次插入7 次删除
  1. 8 7
      mm/slub.c

+ 8 - 7
mm/slub.c

@@ -2129,6 +2129,14 @@ static int calculate_sizes(struct kmem_cache *s)
 	unsigned long size = s->objsize;
 	unsigned long size = s->objsize;
 	unsigned long align = s->align;
 	unsigned long align = s->align;
 
 
+	/*
+	 * Round up object size to the next word boundary. We can only
+	 * place the free pointer at word boundaries and this determines
+	 * the possible location of the free pointer.
+	 */
+	size = ALIGN(size, sizeof(void *));
+
+#ifdef CONFIG_SLUB_DEBUG
 	/*
 	/*
 	 * Determine if we can poison the object itself. If the user of
 	 * Determine if we can poison the object itself. If the user of
 	 * the slab may touch the object after free or before allocation
 	 * the slab may touch the object after free or before allocation
@@ -2140,14 +2148,7 @@ static int calculate_sizes(struct kmem_cache *s)
 	else
 	else
 		s->flags &= ~__OBJECT_POISON;
 		s->flags &= ~__OBJECT_POISON;
 
 
-	/*
-	 * Round up object size to the next word boundary. We can only
-	 * place the free pointer at word boundaries and this determines
-	 * the possible location of the free pointer.
-	 */
-	size = ALIGN(size, sizeof(void *));
 
 
-#ifdef CONFIG_SLUB_DEBUG
 	/*
 	/*
 	 * If we are Redzoning then check if there is some space between the
 	 * If we are Redzoning then check if there is some space between the
 	 * end of the object and the free pointer. If not then add an
 	 * end of the object and the free pointer. If not then add an