From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by kanga.kvack.org (Postfix) with ESMTP id A5CBB6B0075 for ; Wed, 12 Oct 2011 07:09:11 -0400 (EDT) Received: from euspt2 (mailout2.w1.samsung.com [210.118.77.12]) by mailout2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0LSY00FD39N990@mailout2.w1.samsung.com> for linux-mm@kvack.org; Wed, 12 Oct 2011 12:09:09 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LSY00LBA9N8NZ@spt2.w1.samsung.com> for linux-mm@kvack.org; Wed, 12 Oct 2011 12:09:09 +0100 (BST) Date: Wed, 12 Oct 2011 13:08:55 +0200 From: Marek Szyprowski Subject: [PATCH] fixup: mm: alloc_contig_range: increase min_free_kbytes during allocation In-reply-to: <4E93F088.60006@stericsson.com> Message-id: <1318417735-9199-1-git-send-email-m.szyprowski@samsung.com> MIME-version: 1.0 Content-type: TEXT/PLAIN Content-transfer-encoding: 7BIT References: <4E93F088.60006@stericsson.com> Sender: owner-linux-mm@kvack.org List-ID: To: Maxime Coquelin Cc: "'linux-kernel@vger.kernel.org'" , "'linux-arm-kernel@lists.infradead.org'" , "'linux-media@vger.kernel.org'" , "'linux-mm@kvack.org'" , "linaro-mm-sig@lists.linaro.org" , 'Daniel Walker' , 'Russell King' , 'Arnd Bergmann' , 'Jonathan Corbet' , 'Mel Gorman' , 'Chunsang Jeong' , 'Michal Nazarewicz' , 'Dave Hansen' , 'Jesse Barker' , 'Kyungmin Park' , 'Ankita Garg' , 'Andrew Morton' , 'KAMEZAWA Hiroyuki' , "benjamin.gaignard@linaro.org" , Ludovic BARRE , "vincent.guittot@linaro.org" , Marek Szyprowski Signed-off-by: Marek Szyprowski --- mm/page_alloc.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) Hello Maxime, Please check if this patch fixes your lockup issue. It is a bit cruel, but it looks that in case of real low-memory situation page allocation is very complex task which usually ends in waiting for the io/fs and free pages that really don't arrive at all. Best regards -- Marek Szyprowski Samsung Poland R&D Center diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 055aa4c..45473e9 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5872,6 +5872,7 @@ int alloc_contig_range(unsigned long start, unsigned long end, gfp_t flags, unsigned migratetype) { unsigned long outer_start, outer_end; + unsigned int count = end - start; int ret; /* @@ -5900,7 +5901,10 @@ int alloc_contig_range(unsigned long start, unsigned long end, ret = __start_isolate_page_range(pfn_to_maxpage(start), pfn_to_maxpage_up(end), migratetype); if (ret) - goto done; + return ret; + + min_free_kbytes += count * PAGE_SIZE / 1024; + setup_per_zone_wmarks(); ret = __alloc_contig_migrate_range(start, end); if (ret) @@ -5922,8 +5926,10 @@ int alloc_contig_range(unsigned long start, unsigned long end, ret = 0; while (!PageBuddy(pfn_to_page(start & (~0UL << ret)))) - if (WARN_ON(++ret >= MAX_ORDER)) - return -EINVAL; + if (WARN_ON(++ret >= MAX_ORDER)) { + ret = -EINVAL; + goto done; + } outer_start = start & (~0UL << ret); outer_end = alloc_contig_freed_pages(outer_start, end, flags); @@ -5936,6 +5942,9 @@ int alloc_contig_range(unsigned long start, unsigned long end, ret = 0; done: + min_free_kbytes -= count * PAGE_SIZE / 1024; + setup_per_zone_wmarks(); + __undo_isolate_page_range(pfn_to_maxpage(start), pfn_to_maxpage_up(end), migratetype); return ret; -- 1.7.1.569.g6f426 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org