aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/slab_common.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 281600b30100..aa3ca5bb01b5 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -53,17 +53,19 @@ 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
59#ifdef CONFIG_DEBUG_VM 56#ifdef CONFIG_DEBUG_VM
60 if (!name || in_interrupt() || size < sizeof(void *) || 57 if (!name || in_interrupt() || size < sizeof(void *) ||
61 size > KMALLOC_MAX_SIZE) { 58 size > KMALLOC_MAX_SIZE) {
62 printk(KERN_ERR "kmem_cache_create(%s) integrity check" 59 printk(KERN_ERR "kmem_cache_create(%s) integrity check"
63 " failed\n", name); 60 " failed\n", name);
64 goto oops; 61 goto out;
65 } 62 }
63#endif
64
65 get_online_cpus();
66 mutex_lock(&slab_mutex);
66 67
68#ifdef CONFIG_DEBUG_VM
67 list_for_each_entry(s, &slab_caches, list) { 69 list_for_each_entry(s, &slab_caches, list) {
68 char tmp; 70 char tmp;
69 int res; 71 int res;
@@ -102,6 +104,9 @@ oops:
102 mutex_unlock(&slab_mutex); 104 mutex_unlock(&slab_mutex);
103 put_online_cpus(); 105 put_online_cpus();
104 106
107#ifdef CONFIG_DEBUG_VM
108out:
109#endif
105 if (!s && (flags & SLAB_PANIC)) 110 if (!s && (flags & SLAB_PANIC))
106 panic("kmem_cache_create: Failed to create slab '%s'\n", name); 111 panic("kmem_cache_create: Failed to create slab '%s'\n", name);
107 112