diff options
author | Christoph Lameter <cl@linux.com> | 2012-09-04 19:06:14 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-09-05 05:00:35 -0400 |
commit | 208c4358dc4a8f0fe99e49eb8d21a869b01e7d34 (patch) | |
tree | 96720e634f45fb09dde6098fbe37c718413c464b | |
parent | 79576102afc24fcc6627d7a15691e432d9a2eacb (diff) |
mm/slub: Use kmem_cache for the kmem_cache structure
Do not use kmalloc() but kmem_cache_alloc() for the allocation
of the kmem_cache structures in slub.
Reviewed-by: Glauber Costa <glommer@parallels.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r-- | mm/slub.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -213,7 +213,7 @@ static inline int sysfs_slab_alias(struct kmem_cache *s, const char *p) | |||
213 | static inline void sysfs_slab_remove(struct kmem_cache *s) | 213 | static inline void sysfs_slab_remove(struct kmem_cache *s) |
214 | { | 214 | { |
215 | kfree(s->name); | 215 | kfree(s->name); |
216 | kfree(s); | 216 | kmem_cache_free(kmem_cache, s); |
217 | } | 217 | } |
218 | 218 | ||
219 | #endif | 219 | #endif |
@@ -3969,7 +3969,7 @@ struct kmem_cache *__kmem_cache_create(const char *name, size_t size, | |||
3969 | if (!n) | 3969 | if (!n) |
3970 | return NULL; | 3970 | return NULL; |
3971 | 3971 | ||
3972 | s = kmalloc(kmem_size, GFP_KERNEL); | 3972 | s = kmem_cache_alloc(kmem_cache, GFP_KERNEL); |
3973 | if (s) { | 3973 | if (s) { |
3974 | if (kmem_cache_open(s, n, | 3974 | if (kmem_cache_open(s, n, |
3975 | size, align, flags, ctor)) { | 3975 | size, align, flags, ctor)) { |
@@ -3986,7 +3986,7 @@ struct kmem_cache *__kmem_cache_create(const char *name, size_t size, | |||
3986 | list_del(&s->list); | 3986 | list_del(&s->list); |
3987 | kmem_cache_close(s); | 3987 | kmem_cache_close(s); |
3988 | } | 3988 | } |
3989 | kfree(s); | 3989 | kmem_cache_free(kmem_cache, s); |
3990 | } | 3990 | } |
3991 | kfree(n); | 3991 | kfree(n); |
3992 | return NULL; | 3992 | return NULL; |
@@ -5224,7 +5224,7 @@ static void kmem_cache_release(struct kobject *kobj) | |||
5224 | struct kmem_cache *s = to_slab(kobj); | 5224 | struct kmem_cache *s = to_slab(kobj); |
5225 | 5225 | ||
5226 | kfree(s->name); | 5226 | kfree(s->name); |
5227 | kfree(s); | 5227 | kmem_cache_free(kmem_cache, s); |
5228 | } | 5228 | } |
5229 | 5229 | ||
5230 | static const struct sysfs_ops slab_sysfs_ops = { | 5230 | static const struct sysfs_ops slab_sysfs_ops = { |