[PATCH] Slab: Do not fallback to nodes that have not been bootstrapped yet
authorChristoph Lameter <[email protected]>
Sat, 21 Oct 2006 17:24:16 +0000 (10:24 -0700)
committerLinus Torvalds <[email protected]>
Sat, 21 Oct 2006 20:35:06 +0000 (13:35 -0700)
The zonelist may contain zones of nodes that have not been bootstrapped and
we will oops if we try to allocate from those zones.  So check if the node
information for the slab and the node have been setup before attempting an
allocation.  If it has not been setup then skip that zone.

Usually we will not encounter this situation since the slab bootstrap code
avoids falling back before we have setup the respective nodes but we seem
to have a special needs for pppc.

Signed-off-by: Christoph Lameter <[email protected]>
Acked-by: Andy Whitcroft <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Mike Kravetz <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Acked-by: Will Schmidt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/slab.c

index 266449d604bd170c4c1656318c1ded64fcc5404a..84c631f30741016e0e73602129ed6c33d6ca88f9 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3152,12 +3152,15 @@ void *fallback_alloc(struct kmem_cache *cache, gfp_t flags)
        struct zone **z;
        void *obj = NULL;
 
-       for (z = zonelist->zones; *z && !obj; z++)
+       for (z = zonelist->zones; *z && !obj; z++) {
+               int nid = zone_to_nid(*z);
+
                if (zone_idx(*z) <= ZONE_NORMAL &&
-                               cpuset_zone_allowed(*z, flags))
+                               cpuset_zone_allowed(*z, flags) &&
+                               cache->nodelists[nid])
                        obj = __cache_alloc_node(cache,
-                                       flags | __GFP_THISNODE,
-                                       zone_to_nid(*z));
+                                       flags | __GFP_THISNODE, nid);
+       }
        return obj;
 }