lkml.org 
[lkml]   [2013]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 1/5] mm/slab: Fix drain freelist excessively
Date
Changelog:
v1 -> v2:
* Fix the callers that pass # of objects. Make sure they pass # of slabs.

The drain_freelist is called to drain slabs_free lists for cache reap,
cache shrink, memory hotplug callback etc. The tofree parameter should
be the number of slab to free instead of the number of slab objects to
free.

This patch fix the callers that pass # of objects. Make sure they pass #
of slabs.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
mm/slab.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 17298c1..13f5ecc 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1241,7 +1241,8 @@ free_array_cache:
n = cachep->node[node];
if (!n)
continue;
- drain_freelist(cachep, n, n->free_objects);
+ drain_freelist(cachep, n, (n->free_objects +
+ cachep->num - 1) / cachep->num);
}
}

@@ -1408,7 +1409,8 @@ static int __meminit drain_cache_node_node(int node)
if (!n)
continue;

- drain_freelist(cachep, n, n->free_objects);
+ drain_freelist(cachep, n, (n->free_objects +
+ cachep->num - 1) / cachep->num);

if (!list_empty(&n->slabs_full) ||
!list_empty(&n->slabs_partial)) {
@@ -2532,7 +2534,8 @@ static int __cache_shrink(struct kmem_cache *cachep)
if (!n)
continue;

- drain_freelist(cachep, n, n->free_objects);
+ drain_freelist(cachep, n, (n->free_objects +
+ cachep->num - 1) / cachep->num);

ret += !list_empty(&n->slabs_full) ||
!list_empty(&n->slabs_partial);
--
1.8.1.2


\
 
 \ /
  Last update: 2013-07-03 03:21    [W:0.140 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site