From: Pekka Enberg Date: Wed, 10 Jun 2009 17:05:53 +0000 (+0300) Subject: bootmem: use slab if bootmem is no longer available X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=441c7e0a2ed38827b48b907bd1fa29faba2017a3;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git bootmem: use slab if bootmem is no longer available As a preparation for initializing the slab allocator early, make sure the bootmem allocator does not crash and burn if someone calls it after slab is up; otherwise we'd need a flag day for switching to early slab. Acked-by: Johannes Weiner Acked-by: Linus Torvalds Cc: Christoph Lameter Cc: Ingo Molnar Cc: Matt Mackall Cc: Nick Piggin Cc: Yinghai Lu Signed-off-by: Pekka Enberg --- diff --git a/mm/bootmem.c b/mm/bootmem.c index daf92713f7d..457269c73e8 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c @@ -532,6 +532,9 @@ static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata, unsigned long size, unsigned long align, unsigned long goal, unsigned long limit) { + if (WARN_ON_ONCE(slab_is_available())) + return kzalloc(size, GFP_NOWAIT); + #ifdef CONFIG_HAVE_ARCH_BOOTMEM bootmem_data_t *p_bdata;