diff options
author | Christoph Lameter <cl@linux.com> | 2012-09-04 19:38:33 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-09-05 05:00:35 -0400 |
commit | 7c9adf5a5471647f392169ef19d3e81dcfa76045 (patch) | |
tree | 4e32d1875e45eafd4c4c9f2caedcf3419479c0b8 /mm/slab_common.c | |
parent | 686d550d222e8f83f6e709debbedf9d8ef77aec7 (diff) |
mm/sl[aou]b: Move list_add() to slab_common.c
Move the code to append the new kmem_cache to the list of slab caches to
the kmem_cache_create code in the shared code.
This is possible now since the acquisition of the mutex was moved into
kmem_cache_create().
Acked-by: David Rientjes <rientjes@google.com>
Reviewed-by: Glauber Costa <glommer@parallels.com>
Reviewed-by: Joonsoo Kim <js1304@gmail.com>
Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slab_common.c')
-rw-r--r-- | mm/slab_common.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c index fe8dc943c285..5190a7cd02bd 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -111,6 +111,13 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align | |||
111 | if (!s) | 111 | if (!s) |
112 | err = -ENOSYS; /* Until __kmem_cache_create returns code */ | 112 | err = -ENOSYS; /* Until __kmem_cache_create returns code */ |
113 | 113 | ||
114 | /* | ||
115 | * Check if the slab has actually been created and if it was a | ||
116 | * real instatiation. Aliases do not belong on the list | ||
117 | */ | ||
118 | if (s && s->refcount == 1) | ||
119 | list_add(&s->list, &slab_caches); | ||
120 | |||
114 | out_locked: | 121 | out_locked: |
115 | mutex_unlock(&slab_mutex); | 122 | mutex_unlock(&slab_mutex); |
116 | put_online_cpus(); | 123 | put_online_cpus(); |