C14 [02/14] slub: Use kmem_cache for the kmem_cache structure
From: Christoph Lameter <hidden>
Date: 2012-09-04 23:06:16
Do not use kmalloc() but kmem_cache_alloc() for the allocation of the kmem_cache structures in slub. Reviewed-by: Glauber Costa <redacted> Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Christoph Lameter <redacted> --- mm/slub.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Index: linux/mm/slub.c ===================================================================
--- linux.orig/mm/slub.c 2012-09-04 18:00:16.710080309 -0500
+++ linux/mm/slub.c 2012-09-04 18:01:59.767688688 -0500@@ -213,7 +213,7 @@ static inline int sysfs_slab_alias(struc static inline void sysfs_slab_remove(struct kmem_cache *s) { kfree(s->name); - kfree(s); + kmem_cache_free(kmem_cache, s); } #endif
@@ -3969,7 +3969,7 @@ struct kmem_cache *__kmem_cache_create(c if (!n) return NULL; - s = kmalloc(kmem_size, GFP_KERNEL); + s = kmem_cache_alloc(kmem_cache, GFP_KERNEL); if (s) { if (kmem_cache_open(s, n, size, align, flags, ctor)) {
@@ -3986,7 +3986,7 @@ struct kmem_cache *__kmem_cache_create(c list_del(&s->list); kmem_cache_close(s); } - kfree(s); + kmem_cache_free(kmem_cache, s); } kfree(n); return NULL;
@@ -5224,7 +5224,7 @@ static void kmem_cache_release(struct ko struct kmem_cache *s = to_slab(kobj); kfree(s->name); - kfree(s); + kmem_cache_free(kmem_cache, s); } static const struct sysfs_ops slab_sysfs_ops = { --
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>