Commit 6aa32467 authored by Huang Pei's avatar Huang Pei Committed by Thomas Bogendoerfer

MIPS: check return value of pgtable_pmd_page_ctor

+. According to Documentation/vm/split_page_table_lock, handle failure
of pgtable_pmd_page_ctor

+. Use GFP_KERNEL_ACCOUNT instead of GFP_KERNEL|__GFP_ACCOUNT

+. Adjust coding style

Fixes: ed914d48 ("MIPS: add PMD table accounting into MIPS')
Reported-by: default avatarJoshua Kinard <kumba@gentoo.org>
Signed-off-by: default avatarHuang Pei <huangpei@loongson.cn>
Reviewed-by: default avatarJoshua Kinard <kumba@gentoo.org>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent e73f0f0e
...@@ -58,15 +58,20 @@ do { \ ...@@ -58,15 +58,20 @@ do { \
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
{ {
pmd_t *pmd = NULL; pmd_t *pmd;
struct page *pg; struct page *pg;
pg = alloc_pages(GFP_KERNEL | __GFP_ACCOUNT, PMD_ORDER); pg = alloc_pages(GFP_KERNEL_ACCOUNT, PMD_ORDER);
if (pg) { if (!pg)
pgtable_pmd_page_ctor(pg); return NULL;
pmd = (pmd_t *)page_address(pg);
pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table); if (!pgtable_pmd_page_ctor(pg)) {
__free_pages(pg, PMD_ORDER);
return NULL;
} }
pmd = (pmd_t *)page_address(pg);
pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
return pmd; return pmd;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment