[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080520144850.GO4146@shadowen.org>
Date: Tue, 20 May 2008 15:48:51 +0100
From: Andy Whitcroft <apw@...dowen.org>
To: Heiko Carstens <heiko.carstens@...ibm.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Dave Hansen <haveblue@...ibm.com>,
Gerald Schaefer <gerald.schaefer@...ibm.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Yasunori Goto <y-goto@...fujitsu.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] memory hotplug: fix early allocation handling
On Tue, May 20, 2008 at 12:51:45PM +0200, Heiko Carstens wrote:
> From: Heiko Carstens <heiko.carstens@...ibm.com>
>
> 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 <apw@...dowen.org>
> Cc: Dave Hansen <haveblue@...ibm.com>
> Cc: Gerald Schaefer <gerald.schaefer@...ibm.com>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
> Cc: Yasunori Goto <y-goto@...fujitsu.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@...ibm.com>
> ---
> 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 {
It would be nice to be able to check that bootmem is enabled separatly
from whether slab is available, as I am sure there is a time where
neither is available during the change over. But the change looks
reasonable as we cannot use vmalloc until slab is working.
Reviewed-by: Andy Whitcroft <apw@...dowen.org>
-apw
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists