+ slab-fix-kmem_cache_destroy-on-numa.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     slab: Fix kmem_cache_destroy() on NUMA

has been added to the -mm tree.  Its filename is

     slab-fix-kmem_cache_destroy-on-numa.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this


From: Roland Dreier <rdreier@xxxxxxxxx>

With CONFIG_NUMA set, kmem_cache_destroy() may fail and say "Can't free all
objects." The problem is caused by sequences such as the following (suppose
we are on a NUMA machine with two nodes, 0 and 1):

 * Allocate an object from cache on node 0.
 * Free the object on node 1.  The object is put into node 1's alien
   array_cache for node 0.
 * Call kmem_cache_destroy(), which ultimately ends up in __cache_shrink().
 * __cache_shrink() does drain_cpu_caches(), which loops through all nodes.
   For each node it drains the shared array_cache and then handles the
   alien array_cache for the other node.

However this means that node 0's shared array_cache will be drained, and
then node 1 will move the contents of its alien[0] array_cache into that
same shared array_cache.  node 0's shared array_cache is never looked at
again, so the objects left there will appear to be in use when
__cache_shrink() calls __node_shrink() for node 0.  So __node_shrink() will
return 1 and kmem_cache_destroy() will fail.

This patch fixes this by having drain_cpu_caches() do drain_alien_cache()
on every node before it does drain_array() on the nodes' shared
array_caches.

The problem was originally reported by Or Gerlitz <ogerlitz@xxxxxxxxxxxx>.

Cc: Christoph Lameter <clameter@xxxxxxx>
Cc: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
Signed-off-by: Roland Dreier <rolandd@xxxxxxxxx>
Cc: Eric Dumazet <dada1@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 mm/slab.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff -puN mm/slab.c~slab-fix-kmem_cache_destroy-on-numa mm/slab.c
--- 25/mm/slab.c~slab-fix-kmem_cache_destroy-on-numa	Mon May 15 13:14:57 2006
+++ 25-akpm/mm/slab.c	Mon May 15 13:14:57 2006
@@ -2200,11 +2200,14 @@ static void drain_cpu_caches(struct kmem
 	check_irq_on();
 	for_each_online_node(node) {
 		l3 = cachep->nodelists[node];
-		if (l3) {
+		if (l3 && l3->alien)
+			drain_alien_cache(cachep, l3->alien);
+	}
+
+	for_each_online_node(node) {
+		l3 = cachep->nodelists[node];
+		if (l3)
 			drain_array(cachep, l3, l3->shared, 1, node);
-			if (l3->alien)
-				drain_alien_cache(cachep, l3->alien);
-		}
 	}
 }
 
_

Patches currently in -mm which might be from rdreier@xxxxxxxxx are

slab-fix-kmem_cache_destroy-on-numa.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux