diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2012-08-14 17:53:22 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-08-16 02:36:05 -0400 |
commit | 455ce9eb1cfa083da0def023094190aeb133855a (patch) | |
tree | 0326a78991510a6079313981b55206244537e1ff /mm/slab_common.c | |
parent | 48f2474144ac708f1faad97e82a863ca8214b602 (diff) |
mm/slab_common.c: cleanup
Eliminate an ifdef and a label by moving all the CONFIG_DEBUG_VM checking
inside the locked region.
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slab_common.c')
-rw-r--r-- | mm/slab_common.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c index aa3ca5bb01b5..281600b30100 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -53,19 +53,17 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align | |||
53 | { | 53 | { |
54 | struct kmem_cache *s = NULL; | 54 | struct kmem_cache *s = NULL; |
55 | 55 | ||
56 | get_online_cpus(); | ||
57 | mutex_lock(&slab_mutex); | ||
58 | |||
56 | #ifdef CONFIG_DEBUG_VM | 59 | #ifdef CONFIG_DEBUG_VM |
57 | if (!name || in_interrupt() || size < sizeof(void *) || | 60 | if (!name || in_interrupt() || size < sizeof(void *) || |
58 | size > KMALLOC_MAX_SIZE) { | 61 | size > KMALLOC_MAX_SIZE) { |
59 | printk(KERN_ERR "kmem_cache_create(%s) integrity check" | 62 | printk(KERN_ERR "kmem_cache_create(%s) integrity check" |
60 | " failed\n", name); | 63 | " failed\n", name); |
61 | goto out; | 64 | goto oops; |
62 | } | 65 | } |
63 | #endif | ||
64 | |||
65 | get_online_cpus(); | ||
66 | mutex_lock(&slab_mutex); | ||
67 | 66 | ||
68 | #ifdef CONFIG_DEBUG_VM | ||
69 | list_for_each_entry(s, &slab_caches, list) { | 67 | list_for_each_entry(s, &slab_caches, list) { |
70 | char tmp; | 68 | char tmp; |
71 | int res; | 69 | int res; |
@@ -104,9 +102,6 @@ oops: | |||
104 | mutex_unlock(&slab_mutex); | 102 | mutex_unlock(&slab_mutex); |
105 | put_online_cpus(); | 103 | put_online_cpus(); |
106 | 104 | ||
107 | #ifdef CONFIG_DEBUG_VM | ||
108 | out: | ||
109 | #endif | ||
110 | if (!s && (flags & SLAB_PANIC)) | 105 | if (!s && (flags & SLAB_PANIC)) |
111 | panic("kmem_cache_create: Failed to create slab '%s'\n", name); | 106 | panic("kmem_cache_create: Failed to create slab '%s'\n", name); |
112 | 107 | ||