linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/5] mm/slab: Fix drain freelist excessively
@ 2013-07-03  0:49 Wanpeng Li
  2013-07-03  0:49 ` [PATCH v2 2/5] mm/slab: Sharing s_next and s_stop between slab and slub Wanpeng Li
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Wanpeng Li @ 2013-07-03  0:49 UTC (permalink / raw)
  To: Pekka Enberg, Christoph Lameter, Matt Mackall
  Cc: Glauber Costa, Andrew Morton, Joonsoo Kim, David Rientjes,
	linux-mm, linux-kernel, Wanpeng Li

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-07-03 23:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-03  0:49 [PATCH v2 1/5] mm/slab: Fix drain freelist excessively Wanpeng Li
2013-07-03  0:49 ` [PATCH v2 2/5] mm/slab: Sharing s_next and s_stop between slab and slub Wanpeng Li
2013-07-03 13:54   ` Christoph Lameter
2013-07-03  0:49 ` [PATCH v2 3/5] mm/slab: Fix /proc/slabinfo unwriteable for slab Wanpeng Li
2013-07-03 13:55   ` Christoph Lameter
2013-07-03  0:49 ` [PATCH v2 4/5] mm/slub: Drop unnecessary nr_partials Wanpeng Li
2013-07-03 13:59   ` Christoph Lameter
2013-07-03  0:49 ` [PATCH v2 5/5] mm/slub: Use node_nr_slabs and node_nr_objs in get_slabinfo Wanpeng Li
2013-07-03 13:54 ` [PATCH v2 1/5] mm/slab: Fix drain freelist excessively Christoph Lameter
2013-07-03 23:29   ` Wanpeng Li
2013-07-03 23:29   ` Wanpeng Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).