>From 9dfd9dec7a1d67265df88d75e55734d4ac049441 Mon Sep 17 00:00:00 2001 From: Daniel Santos Date: Wed, 8 Feb 2012 21:26:49 -0600 Subject: compile out effectively dead code from kmem_cache_create MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1.7.3.4" This is a multi-part message in MIME format. --------------1.7.3.4 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit --- mm/slab.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) --------------1.7.3.4 Content-Type: text/x-patch; name="0001-compile-out-effectively-dead-code-from-kmem_cache_cr.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-compile-out-effectively-dead-code-from-kmem_cache_cr.patch" diff --git a/mm/slab.c b/mm/slab.c index f0bd785..1840a4a 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2326,6 +2326,7 @@ kmem_cache_create (const char *name, size_t size, size_t align, ralign = BYTES_PER_WORD; } +#if DEBUG /* * Redzoning and user store require word alignment or possibly larger. * Note this will be overridden by architecture or caller mandated @@ -2341,6 +2342,7 @@ kmem_cache_create (const char *name, size_t size, size_t align, size += REDZONE_ALIGN - 1; size &= ~(REDZONE_ALIGN - 1); } +#endif /* 2) arch mandated alignment */ if (ralign < ARCH_SLAB_MINALIGN) { @@ -2350,9 +2352,13 @@ kmem_cache_create (const char *name, size_t size, size_t align, if (ralign < align) { ralign = align; } + +#if DEBUG /* disable debug if necessary */ if (ralign > __alignof__(unsigned long long)) flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER); +#endif + /* * 4) Store it. */ @@ -2442,7 +2448,7 @@ kmem_cache_create (const char *name, size_t size, size_t align, slab_size = cachep->num * sizeof(kmem_bufctl_t) + sizeof(struct slab); -#ifdef CONFIG_PAGE_POISONING +#if DEBUG && defined(CONFIG_PAGE_POISONING) /* If we're going to use the generic kernel_map_pages() * poisoning, then it's going to smash the contents of * the redzone and userword anyhow, so switch them off. --------------1.7.3.4--