Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759940Ab3HOAcF (ORCPT ); Wed, 14 Aug 2013 20:32:05 -0400 Received: from e28smtp09.in.ibm.com ([122.248.162.9]:40497 "EHLO e28smtp09.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759105Ab3HOAcC (ORCPT ); Wed, 14 Aug 2013 20:32:02 -0400 From: Wanpeng Li To: Andrew Morton Cc: Rik van Riel , Dave Hansen , Fengguang Wu , Joonsoo Kim , Johannes Weiner , Tejun Heo , Yasuaki Ishimatsu , David Rientjes , KOSAKI Motohiro , Jiri Kosina , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wanpeng Li Subject: [PATCH 1/4] mm/pgtable: Fix continue to preallocate pmds even if failure occurrence Date: Thu, 15 Aug 2013 08:31:40 +0800 Message-Id: <1376526703-2081-1-git-send-email-liwanp@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.5.4 X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13081500-2674-0000-0000-00000A3DC181 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1030 Lines: 34 preallocate_pmds will continue to preallocate pmds even if failure occurrence, and then free all the preallocate pmds if there is failure, this patch fix it by stop preallocate if failure occurrence and go to free path. Signed-off-by: Wanpeng Li --- arch/x86/mm/pgtable.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index dfa537a..ad3397a 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -200,8 +200,10 @@ static int preallocate_pmds(pmd_t *pmds[]) for(i = 0; i < PREALLOCATED_PMDS; i++) { pmd_t *pmd = (pmd_t *)__get_free_page(PGALLOC_GFP); - if (pmd == NULL) + if (pmd == NULL) { failed = true; + break; + } pmds[i] = pmd; } -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/