diff options
author | Johannes Weiner <[email protected]> | 2012-05-29 15:06:35 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2012-05-29 16:22:22 -0700 |
commit | 2c478eae96501163c5c5d5f682bba4d34a7ea1d4 (patch) | |
tree | 0c42430aa1b4209df62b34662343f32febf2cd36 | |
parent | 421456edd27cf512b8f0025245a0f3572bd69b00 (diff) |
mm: nobootmem: panic on node-specific allocation failure
__alloc_bootmem_node and __alloc_bootmem_low_node documentation claims
the functions panic on allocation failure. Do it.
Signed-off-by: Johannes Weiner <[email protected]>
Acked-by: Yinghai Lu <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Acked-by: David S. Miller <[email protected]>
Cc: Gavin Shan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | mm/nobootmem.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/mm/nobootmem.c b/mm/nobootmem.c index 1983fb1c7026..cca76207e61a 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c @@ -305,11 +305,17 @@ again: ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align, goal, -1ULL); - if (!ptr && goal) { + if (ptr) + return ptr; + + if (goal) { goal = 0; goto again; } - return ptr; + + printk(KERN_ALERT "bootmem alloc of %lu bytes failed!\n", size); + panic("Out of memory"); + return NULL; } void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size, @@ -407,6 +413,12 @@ void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size, if (ptr) return ptr; - return __alloc_memory_core_early(MAX_NUMNODES, size, align, - goal, ARCH_LOW_ADDRESS_LIMIT); + ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align, + goal, ARCH_LOW_ADDRESS_LIMIT); + if (ptr) + return ptr; + + printk(KERN_ALERT "bootmem alloc of %lu bytes failed!\n", size); + panic("Out of memory"); + return NULL; } |