[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE9FiQVVvppc0iuxFEoqU+Pxq0A2c=uoByDGvYEccMU2kahJbQ@mail.gmail.com>
Date: Mon, 7 May 2012 12:17:04 -0700
From: Yinghai Lu <yinghai@...nel.org>
To: Johannes Weiner <hannes@...xchg.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Gavin Shan <shangw@...ux.vnet.ibm.com>,
David Miller <davem@...emloft.net>, Tejun Heo <tj@...nel.org>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [patch 07/10] mm: nobootmem: panic on node-specific allocation failure
On Mon, May 7, 2012 at 4:37 AM, Johannes Weiner <hannes@...xchg.org> wrote:
> __alloc_bootmem_node and __alloc_bootmem_low_node documentation claims
> the functions panic on allocation failure. Do it.
>
> Signed-off-by: Johannes Weiner <hannes@...xchg.org>
> ---
> mm/nobootmem.c | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/mm/nobootmem.c b/mm/nobootmem.c
> index e53bb8a..b078ff8 100644
> --- a/mm/nobootmem.c
> +++ b/mm/nobootmem.c
> @@ -306,11 +306,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,
> @@ -408,6 +414,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;
> }
Acked-by: Yinghai Lu <yinghai@...nel.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists