mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-08 06:03:24 +00:00
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>
This commit is contained in:
parent
79576102af
commit
208c4358dc
@ -213,7 +213,7 @@ static inline int sysfs_slab_alias(struct kmem_cache *s, const char *p)
|
|||||||
static inline void sysfs_slab_remove(struct kmem_cache *s)
|
static inline void sysfs_slab_remove(struct kmem_cache *s)
|
||||||
{
|
{
|
||||||
kfree(s->name);
|
kfree(s->name);
|
||||||
kfree(s);
|
kmem_cache_free(kmem_cache, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -3969,7 +3969,7 @@ struct kmem_cache *__kmem_cache_create(const char *name, size_t size,
|
|||||||
if (!n)
|
if (!n)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
s = kmalloc(kmem_size, GFP_KERNEL);
|
s = kmem_cache_alloc(kmem_cache, GFP_KERNEL);
|
||||||
if (s) {
|
if (s) {
|
||||||
if (kmem_cache_open(s, n,
|
if (kmem_cache_open(s, n,
|
||||||
size, align, flags, ctor)) {
|
size, align, flags, ctor)) {
|
||||||
@ -3986,7 +3986,7 @@ struct kmem_cache *__kmem_cache_create(const char *name, size_t size,
|
|||||||
list_del(&s->list);
|
list_del(&s->list);
|
||||||
kmem_cache_close(s);
|
kmem_cache_close(s);
|
||||||
}
|
}
|
||||||
kfree(s);
|
kmem_cache_free(kmem_cache, s);
|
||||||
}
|
}
|
||||||
kfree(n);
|
kfree(n);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -5224,7 +5224,7 @@ static void kmem_cache_release(struct kobject *kobj)
|
|||||||
struct kmem_cache *s = to_slab(kobj);
|
struct kmem_cache *s = to_slab(kobj);
|
||||||
|
|
||||||
kfree(s->name);
|
kfree(s->name);
|
||||||
kfree(s);
|
kmem_cache_free(kmem_cache, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct sysfs_ops slab_sysfs_ops = {
|
static const struct sysfs_ops slab_sysfs_ops = {
|
||||||
|
Loading…
Reference in New Issue
Block a user