Re: Add SYSTEM_BOOTING_KMALLOC_AVAIL system_state

From: Andrew Morton
Date: Tue May 09 2006 - 01:52:05 EST


Mike Kravetz <kravetz@xxxxxxxxxx> wrote:
>
> There are a few places that check the system_state variable to
> determine if they should use the bootmem or kmalloc allocator.
> However, this is not accurate as system_state transitions from
> SYSTEM_BOOTING to SYSTEM_RUNNING well after the bootmem allocator
> is no longer usable. Introduce the SYSTEM_BOOTING_KMALLOC_AVAIL
> state which indicates the kmalloc allocator is available for use.

Let's not do this - system_state is getting out of control.

How about some private boolean in slab.c, and some special allocation
function like

void __init *alloc_memory_early(size_t size, gfp_t gfp_flags)
{
if (slab_is_available)
return kmalloc(size, gfp_flags);
return alloc_bootmem(size);
}

?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/