From: Yinghai Lu Date: Tue, 17 Jul 2012 22:47:51 +0000 (-0700) Subject: bootmem: make ___alloc_bootmem_node_nopanic() really nopanic X-Git-Tag: v3.5~22^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c8f4a2d095bcb7ff798f984b9c7d16b4c8d194c3;p=profile%2Fivi%2Fkernel-x86-ivi.git bootmem: make ___alloc_bootmem_node_nopanic() really nopanic In reaction to commit 99ab7b19440a ("mm: sparse: fix usemap allocation above node descriptor section") Johannes said: | while backporting the below patch, I realised that your fix busted | f5bf18fa22f8 again. The problem was not a panicking version on | allocation failure but when the usemap size was too large such that | goal + size > limit triggers the BUG_ON in the bootmem allocator. So | we need a version that passes limit ONLY if the usemap is smaller than | the section. after checking the code, the name of ___alloc_bootmem_node_nopanic() does not reflect the fact. Make bootmem really not panic. Hope will kill bootmem sooner. Signed-off-by: Yinghai Lu Cc: Johannes Weiner Cc: [3.3.x, 3.4.x] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/bootmem.c b/mm/bootmem.c index 7309663..bcb63ac 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c @@ -710,6 +710,10 @@ again: if (ptr) return ptr; + /* do not panic in alloc_bootmem_bdata() */ + if (limit && goal + size > limit) + limit = 0; + ptr = alloc_bootmem_bdata(pgdat->bdata, size, align, goal, limit); if (ptr) return ptr;