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>
static inline void sysfs_slab_remove(struct kmem_cache *s)
{
kfree(s->name);
static inline void sysfs_slab_remove(struct kmem_cache *s)
{
kfree(s->name);
+ kmem_cache_free(kmem_cache, s);
- 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)) {
if (s) {
if (kmem_cache_open(s, n,
size, align, flags, ctor)) {
list_del(&s->list);
kmem_cache_close(s);
}
list_del(&s->list);
kmem_cache_close(s);
}
+ kmem_cache_free(kmem_cache, s);
struct kmem_cache *s = to_slab(kobj);
kfree(s->name);
struct kmem_cache *s = to_slab(kobj);
kfree(s->name);
+ kmem_cache_free(kmem_cache, s);
}
static const struct sysfs_ops slab_sysfs_ops = {
}
static const struct sysfs_ops slab_sysfs_ops = {