aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Davydov <[email protected]>2015-02-12 14:59:44 -0800
committerLinus Torvalds <[email protected]>2015-02-12 18:54:10 -0800
commitce3712d74d8ed531a9fd0fbb711ff8fefbacdd9f (patch)
treeea28f9bef6a3eccd26a696a6c1254c358a01b2a9
parent832f37f5d5f5c7281880c21eb09508750b67f540 (diff)
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: Vladimir Davydov <[email protected]> Acked-by: Christoph Lameter <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: David Rientjes <[email protected]> Cc: Joonsoo Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--mm/slub.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mm/slub.c b/mm/slub.c
index d97b692165d2..7fa27aee9b6e 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -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;
flush_all(s);
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)