linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] mm/pgtable: Fix continue to preallocate pmds even if failure occurrence
@ 2013-08-20  6:54 Wanpeng Li
  2013-08-20  6:54 ` [PATCH v2 2/4] mm/sparse: introduce alloc_usemap_and_memmap Wanpeng Li
                   ` (4 more replies)
  0 siblings, 5 replies; 31+ messages in thread
From: Wanpeng Li @ 2013-08-20  6:54 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Dave Hansen, Rik van Riel, Fengguang Wu, Joonsoo Kim,
	Johannes Weiner, Tejun Heo, Yasuaki Ishimatsu, David Rientjes,
	KOSAKI Motohiro, Jiri Kosina, linux-mm, linux-kernel, Wanpeng Li

v1 -> v2:
 * remove failed.

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.

Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
 arch/x86/mm/pgtable.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index dfa537a..65c2106 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -196,21 +196,18 @@ static void free_pmds(pmd_t *pmds[])
 static int preallocate_pmds(pmd_t *pmds[])
 {
 	int i;
-	bool failed = false;
 
 	for(i = 0; i < PREALLOCATED_PMDS; i++) {
 		pmd_t *pmd = (pmd_t *)__get_free_page(PGALLOC_GFP);
 		if (pmd == NULL)
-			failed = true;
+			goto err;
 		pmds[i] = pmd;
 	}
 
-	if (failed) {
-		free_pmds(pmds);
-		return -ENOMEM;
-	}
-
 	return 0;
+err:
+	free_pmds(pmds);
+	return -ENOMEM;
 }
 
 /*
-- 
1.8.1.2

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2013-08-29  5:33 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-20  6:54 [PATCH v2 1/4] mm/pgtable: Fix continue to preallocate pmds even if failure occurrence Wanpeng Li
2013-08-20  6:54 ` [PATCH v2 2/4] mm/sparse: introduce alloc_usemap_and_memmap Wanpeng Li
2013-08-20 23:07   ` Andrew Morton
2013-08-21  0:02     ` Yinghai Lu
2013-08-21  3:11       ` Wanpeng Li
2013-08-21  3:11       ` Wanpeng Li
     [not found]       ` <52142ffe.84c0440a.57e5.02acSMTPIN_ADDED_BROKEN@mx.google.com>
2013-08-21  4:28         ` Yinghai Lu
2013-08-21  7:29           ` Wanpeng Li
2013-08-21  7:29           ` Wanpeng Li
     [not found]           ` <52146c58.a3e2440a.0f5a.ffffed8dSMTPIN_ADDED_BROKEN@mx.google.com>
2013-08-22  5:19             ` Yinghai Lu
2013-08-22 12:08               ` Wanpeng Li
2013-08-22 12:14                 ` Wanpeng Li
2013-08-22 12:14                 ` Wanpeng Li
2013-08-22 12:08               ` Wanpeng Li
     [not found]               ` <521600cc.22ab440a.2703.53f1SMTPIN_ADDED_BROKEN@mx.google.com>
2013-08-29  2:18                 ` Yinghai Lu
2013-08-29  2:34                   ` Yinghai Lu
2013-08-29  2:42                     ` Yinghai Lu
2013-08-29  2:51                       ` Wanpeng Li
2013-08-29  2:51                       ` Wanpeng Li
     [not found]                       ` <521eb73e.e3bf420a.2ad0.09c2SMTPIN_ADDED_BROKEN@mx.google.com>
2013-08-29  4:10                         ` Yinghai Lu
2013-08-29  5:32                           ` Wanpeng Li
2013-08-29  5:32                           ` Wanpeng Li
2013-08-20  6:54 ` [PATCH v2 3/4] mm/writeback: make writeback_inodes_wb static Wanpeng Li
2013-08-20 16:01   ` Seth Jennings
2013-08-20  6:54 ` [PATCH v2 4/4] mm/vmalloc: use wrapper function get_vm_area_size to caculate size of vm area Wanpeng Li
2013-08-20 16:03   ` Seth Jennings
2013-08-20 16:00 ` [PATCH v2 1/4] mm/pgtable: Fix continue to preallocate pmds even if failure occurrence Seth Jennings
2013-08-20 23:04 ` Andrew Morton
2013-08-20 23:39   ` Wanpeng Li
2013-08-20 23:39   ` Wanpeng Li
     [not found]   ` <5213fe45.660c420a.4066.ffffd8c7SMTPIN_ADDED_BROKEN@mx.google.com>
2013-08-21  0:18     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).