Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755399AbYAWOtx (ORCPT ); Wed, 23 Jan 2008 09:49:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753679AbYAWOto (ORCPT ); Wed, 23 Jan 2008 09:49:44 -0500 Received: from courier.cs.helsinki.fi ([128.214.9.1]:58044 "EHLO mail.cs.helsinki.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753023AbYAWOtm (ORCPT ); Wed, 23 Jan 2008 09:49:42 -0500 Date: Wed, 23 Jan 2008 16:49:41 +0200 (EET) From: Pekka J Enberg To: Mel Gorman cc: akpm@linux-foundation.org, Christoph Lameter , linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org, "Aneesh Kumar K.V" , hanth Aravamudan , KAMEZAWA Hiroyuki , lee.schermerhorn@hp.com, Linux MM , Olaf Hering Subject: Re: [PATCH] Fix boot problem in situations where the boot CPU is running on a memoryless node In-Reply-To: Message-ID: References: <20080118213011.GC10491@csn.ul.ie> <20080118225713.GA31128@aepfle.de> <20080122195448.GA15567@csn.ul.ie> <20080122214505.GA15674@aepfle.de> <20080123075821.GA17713@aepfle.de> <20080123105044.GD21455@csn.ul.ie> <20080123121459.GA18631@aepfle.de> <20080123125236.GA18876@aepfle.de> <20080123135513.GA14175@csn.ul.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2796 Lines: 88 Hi, On Wed, 23 Jan 2008, Pekka J Enberg wrote: > > I still think Christoph's kmem_getpages() patch is correct (to fix > > cache_grow() oops) but I overlooked the fact that none the callers of > > ____cache_alloc_node() deal with bootstrapping (with the exception of > > __cache_alloc_node() that even has a comment about it). > > So something like this (totally untested) patch on top of current git: Sorry, removed a BUG_ON() from cache_alloc_refill() by mistake, here's a better one: [PATCH] slab: fix allocation on memoryless nodes From: Pekka Enberg As memoryless nodes do not have a nodelist, change cache_alloc_refill() to bail out for those and let ____cache_alloc_node() always deal with that by resorting to fallback_alloc(). Furthermore, don't let kmem_getpages() call alloc_pages_node() if nodeid passed to it is -1 as the latter will always translate that to numa_node_id() which might not have ->nodelist that caused the invocation of fallback_alloc() in the first place (for example, during bootstrap). Signed-off-by: Pekka Enberg --- mm/slab.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) Index: linux-2.6/mm/slab.c =================================================================== --- linux-2.6.orig/mm/slab.c +++ linux-2.6/mm/slab.c @@ -1668,7 +1668,11 @@ static void *kmem_getpages(struct kmem_c if (cachep->flags & SLAB_RECLAIM_ACCOUNT) flags |= __GFP_RECLAIMABLE; - page = alloc_pages_node(nodeid, flags, cachep->gfporder); + if (nodeid == -1) + page = alloc_pages(flags, cachep->gfporder); + else + page = alloc_pages_node(nodeid, flags, cachep->gfporder); + if (!page) return NULL; @@ -2975,9 +2979,11 @@ retry: */ batchcount = BATCHREFILL_LIMIT; } + BUG_ON(ac->avail > 0); l3 = cachep->nodelists[node]; + if (!l3) + return NULL; - BUG_ON(ac->avail > 0 || !l3); spin_lock(&l3->list_lock); /* See if we can refill from the shared array */ @@ -3317,7 +3323,8 @@ static void *____cache_alloc_node(struct int x; l3 = cachep->nodelists[nodeid]; - BUG_ON(!l3); + if (!l3) + return fallback_alloc(cachep, flags); retry: check_irq_off(); @@ -3394,12 +3401,6 @@ __cache_alloc_node(struct kmem_cache *ca if (unlikely(nodeid == -1)) nodeid = numa_node_id(); - if (unlikely(!cachep->nodelists[nodeid])) { - /* Node not bootstrapped yet */ - ptr = fallback_alloc(cachep, flags); - goto out; - } - if (nodeid == numa_node_id()) { /* * Use the locally cached objects if possible. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/