mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
mm/sl[aou]b: Extract a common function for kmem_cache_destroy
kmem_cache_destroy does basically the same in all allocators. Extract common code which is easy since we already have common mutex handling. Reviewed-by: Glauber Costa <[email protected]> Signed-off-by: Christoph Lameter <[email protected]> Signed-off-by: Pekka Enberg <[email protected]>
This commit is contained in:
parent
7c9adf5a54
commit
945cf2b619
5 changed files with 49 additions and 75 deletions
15
mm/slob.c
15
mm/slob.c
|
|
@ -538,18 +538,11 @@ struct kmem_cache *__kmem_cache_create(const char *name, size_t size,
|
|||
return c;
|
||||
}
|
||||
|
||||
void kmem_cache_destroy(struct kmem_cache *c)
|
||||
void __kmem_cache_destroy(struct kmem_cache *c)
|
||||
{
|
||||
mutex_lock(&slab_mutex);
|
||||
list_del(&c->list);
|
||||
mutex_unlock(&slab_mutex);
|
||||
|
||||
kmemleak_free(c);
|
||||
if (c->flags & SLAB_DESTROY_BY_RCU)
|
||||
rcu_barrier();
|
||||
slob_free(c, sizeof(struct kmem_cache));
|
||||
}
|
||||
EXPORT_SYMBOL(kmem_cache_destroy);
|
||||
|
||||
void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
|
||||
{
|
||||
|
|
@ -617,6 +610,12 @@ unsigned int kmem_cache_size(struct kmem_cache *c)
|
|||
}
|
||||
EXPORT_SYMBOL(kmem_cache_size);
|
||||
|
||||
int __kmem_cache_shutdown(struct kmem_cache *c)
|
||||
{
|
||||
/* No way to check for remaining objects */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int kmem_cache_shrink(struct kmem_cache *d)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue