Skip to content

Commit 455ce9e

Browse files
akpm00penberg
authored andcommitted
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>
1 parent 48f2474 commit 455ce9e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

mm/slab_common.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,17 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align
5353
{
5454
struct kmem_cache *s = NULL;
5555

56+
get_online_cpus();
57+
mutex_lock(&slab_mutex);
58+
5659
#ifdef CONFIG_DEBUG_VM
5760
if (!name || in_interrupt() || size < sizeof(void *) ||
5861
size > KMALLOC_MAX_SIZE) {
5962
printk(KERN_ERR "kmem_cache_create(%s) integrity check"
60-
" failed\n", name);
61-
goto out;
63+
" failed\n", name);
64+
goto oops;
6265
}
63-
#endif
64-
65-
get_online_cpus();
66-
mutex_lock(&slab_mutex);
6766

68-
#ifdef CONFIG_DEBUG_VM
6967
list_for_each_entry(s, &slab_caches, list) {
7068
char tmp;
7169
int res;
@@ -104,9 +102,6 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align
104102
mutex_unlock(&slab_mutex);
105103
put_online_cpus();
106104

107-
#ifdef CONFIG_DEBUG_VM
108-
out:
109-
#endif
110105
if (!s && (flags & SLAB_PANIC))
111106
panic("kmem_cache_create: Failed to create slab '%s'\n", name);
112107

0 commit comments

Comments
 (0)