[PATCH] mm/slab: clean-up kmem_cache_node setup-fix
From: Joonsoo Kim
Date: Sun Apr 10 2016 - 21:48:29 EST
After calling free_block(), we need to re-calculate array_cache's
avail counter. Fix it.
And, it's better to free objects in shared array when it is
really necessary. Check it before calling free_block().
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
---
mm/slab.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/slab.c b/mm/slab.c
index fcd5fbb..27cb390 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -927,9 +927,10 @@ static int setup_kmem_cache_node(struct kmem_cache *cachep,
n = get_node(cachep, node);
spin_lock_irq(&n->list_lock);
- if (n->shared) {
+ if (n->shared && force_change) {
free_block(cachep, n->shared->entry,
n->shared->avail, node, &list);
+ n->shared->avail = 0;
}
if (!n->shared || force_change) {
--
1.9.1