Quantcast
Channel: Serverphorums.com - Linux Kernel
Viewing all articles
Browse latest Browse all 24115

[PATCH v2 1/4] mm/pgtable: Fix continue to preallocate pmds even if failure occurrence (1 reply)

$
0
0
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 = pmd;
}

- if (failed) {
- free_pmds(pmds);
- return -ENOMEM;
- }
-
return 0;
+err:
+ free_pmds(pmds);
+ return -ENOMEM;
}

/*
--
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/

Viewing all articles
Browse latest Browse all 24115

Trending Articles