Skip to content

Commit c8f4a2d

Browse files
Yinghai Lutorvalds
Yinghai Lu
authored andcommitted
bootmem: make ___alloc_bootmem_node_nopanic() really nopanic
In reaction to commit 99ab7b1 ("mm: sparse: fix usemap allocation above node descriptor section") Johannes said: | while backporting the below patch, I realised that your fix busted | f5bf18f 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 <yinghai@kernel.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: <stable@vger.kernel.org> [3.3.x, 3.4.x] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 84a1caf commit c8f4a2d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mm/bootmem.c

+4
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,10 @@ void * __init ___alloc_bootmem_node_nopanic(pg_data_t *pgdat,
710710
if (ptr)
711711
return ptr;
712712

713+
/* do not panic in alloc_bootmem_bdata() */
714+
if (limit && goal + size > limit)
715+
limit = 0;
716+
713717
ptr = alloc_bootmem_bdata(pgdat->bdata, size, align, goal, limit);
714718
if (ptr)
715719
return ptr;

0 commit comments

Comments
 (0)