lkml.org 
[lkml]   [2020]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] mm/slub: Fix release all resources used by a slab cache
Date
The function of __kmem_cache_shutdown() is that release all resources
used by the slab cache, while currently it stop release resources when
the preceding node is not empty.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
mm/slub.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index b73505df3de2..4e477ef0f2b9 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3839,6 +3839,7 @@ bool __kmem_cache_empty(struct kmem_cache *s)
*/
int __kmem_cache_shutdown(struct kmem_cache *s)
{
+ int ret = 0;
int node;
struct kmem_cache_node *n;

@@ -3846,11 +3847,11 @@ int __kmem_cache_shutdown(struct kmem_cache *s)
/* Attempt to free all objects */
for_each_kmem_cache_node(s, node, n) {
free_partial(s, n);
- if (node_nr_slabs(n))
- return 1;
+ if (!ret && node_nr_slabs(n))
+ ret = 1;
}
sysfs_slab_remove(s);
- return 0;
+ return ret;
}

/********************************************************************
--
2.11.0
\
 
 \ /
  Last update: 2020-06-14 14:40    [W:0.117 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site