lkml.org 
[lkml]   [2015]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH -mm v2 2/3] slub: fix kmem_cache_shrink return value
Date
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 <vdavydov@parallels.com>
---
mm/slub.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mm/slub.c b/mm/slub.c
index dbf9334b6a5c..63abe52c2951 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3379,6 +3379,7 @@ int __kmem_cache_shrink(struct kmem_cache *s)
LIST_HEAD(discard);
struct list_head promote[SHRINK_PROMOTE_MAX];
unsigned long flags;
+ int ret = 0;

for (i = 0; i < SHRINK_PROMOTE_MAX; i++)
INIT_LIST_HEAD(promote + i);
@@ -3419,6 +3420,9 @@ int __kmem_cache_shrink(struct kmem_cache *s)
for (i = SHRINK_PROMOTE_MAX - 1; i >= 0; i--)
list_splice_init(promote + i, &n->partial);

+ if (n->nr_partial || slabs_node(s, node))
+ ret = 1;
+
spin_unlock_irqrestore(&n->list_lock, flags);

/* Release empty slabs */
@@ -3426,7 +3430,7 @@ int __kmem_cache_shrink(struct kmem_cache *s)
discard_slab(s, page);
}

- return 0;
+ return ret;
}

static int slab_mem_going_offline_callback(void *arg)
--
1.7.10.4


\
 
 \ /
  Last update: 2015-01-29 03:01    [W:0.075 / U:1.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site