From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933828AbYEUHjr (ORCPT ); Wed, 21 May 2008 03:39:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757267AbYEUHjf (ORCPT ); Wed, 21 May 2008 03:39:35 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:44966 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754820AbYEUHje (ORCPT ); Wed, 21 May 2008 03:39:34 -0400 Date: Wed, 21 May 2008 16:29:14 +0900 From: Yasunori Goto To: Heiko Carstens Subject: Re: [PATCH] memory hotplug: fix early allocation handling Cc: Andrew Morton , Andy Whitcroft , Dave Hansen , Gerald Schaefer , KAMEZAWA Hiroyuki , linux-mm@kvack.org, linux-kernel@vger.kernel.org In-Reply-To: <20080520105145.GA24526@osiris.boeblingen.de.ibm.com> References: <20080520105145.GA24526@osiris.boeblingen.de.ibm.com> X-Mailer-Plugin: BkASPil for Becky!2 Ver.2.068 Message-Id: <20080521162657.587A.E1E9C6FF@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.45 [ja] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Looks good to me. Thanks. Acked-by: Yasunori Goto > From: Heiko Carstens > > Trying to add memory via add_memory() from within an initcall function > results in > > bootmem alloc of 163840 bytes failed! > Kernel panic - not syncing: Out of memory > > This is caused by zone_wait_table_init() which uses system_state to > decide if it should use the bootmem allocator or not. > When initcalls are handled the system_state is still SYSTEM_BOOTING > but the bootmem allocator doesn't work anymore. So the allocation > will fail. > > To fix this use slab_is_available() instead as indicator like we do > it everywhere else. > > Cc: Andy Whitcroft > Cc: Dave Hansen > Cc: Gerald Schaefer > Cc: KAMEZAWA Hiroyuki > Cc: Yasunori Goto > Signed-off-by: Heiko Carstens > --- > mm/page_alloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > Index: linux-2.6/mm/page_alloc.c > =================================================================== > --- linux-2.6.orig/mm/page_alloc.c > +++ linux-2.6/mm/page_alloc.c > @@ -2804,7 +2804,7 @@ int zone_wait_table_init(struct zone *zo > alloc_size = zone->wait_table_hash_nr_entries > * sizeof(wait_queue_head_t); > > - if (system_state == SYSTEM_BOOTING) { > + if (!slab_is_available()) { > zone->wait_table = (wait_queue_head_t *) > alloc_bootmem_node(pgdat, alloc_size); > } else { -- Yasunori Goto