Commit ce3712d7 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Linus Torvalds
Browse files

slub: fix kmem_cache_shrink return value

It is supposed to return 0 if the cache has no remaining objects and 1
otherwise, while currently it always returns 0.  Fix it.

Signed-off-by: default avatarVladimir Davydov <>
Acked-by: default avatarChristoph Lameter <>
Cc: Pekka Enberg <>
Cc: David Rientjes <>
Cc: Joonsoo Kim <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 832f37f5
......@@ -3379,6 +3379,7 @@ int __kmem_cache_shrink(struct kmem_cache *s)
struct list_head discard;
struct list_head promote[SHRINK_PROMOTE_MAX];
unsigned long flags;
int ret = 0;
for_each_kmem_cache_node(s, node, n) {
......@@ -3425,9 +3426,12 @@ int __kmem_cache_shrink(struct kmem_cache *s)
/* Release empty slabs */
list_for_each_entry_safe(page, t, &discard, lru)
discard_slab(s, page);
if (slabs_node(s, node))
ret = 1;
return 0;
return ret;
static int slab_mem_going_offline_callback(void *arg)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment