* [PATCH V2]: check return value of pgtalbe_pmd_page_ctor
@ 2021-07-21 5:20 Huang Pei
2021-07-21 5:20 ` [PATCH] MIPS: check return value of pgtable_pmd_page_ctor Huang Pei
0 siblings, 1 reply; 3+ messages in thread
From: Huang Pei @ 2021-07-21 5:20 UTC (permalink / raw)
To: Thomas Bogendoerfer, ambrosehua
Cc: Bibo Mao, linux-mips, Jiaxun Yang, Paul Burton, Li Xuefeng,
Yang Tiezhu, Gao Juxin, Huacai Chen, Jinyang He
V2:
Adjust coding style, more readable, following Joshua Kinard's
advice
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] MIPS: check return value of pgtable_pmd_page_ctor
2021-07-21 5:20 [PATCH V2]: check return value of pgtalbe_pmd_page_ctor Huang Pei
@ 2021-07-21 5:20 ` Huang Pei
2021-07-21 9:03 ` Thomas Bogendoerfer
0 siblings, 1 reply; 3+ messages in thread
From: Huang Pei @ 2021-07-21 5:20 UTC (permalink / raw)
To: Thomas Bogendoerfer, ambrosehua
Cc: Bibo Mao, linux-mips, Jiaxun Yang, Paul Burton, Li Xuefeng,
Yang Tiezhu, Gao Juxin, Huacai Chen, Jinyang He, Joshua Kinard
+. 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
Reported-by: Joshua Kinard <kumba@gentoo.org>
Signed-off-by: Huang Pei <huangpei@loongson.cn>
---
arch/mips/include/asm/pgalloc.h | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
index d0cf997b4ba8..139b4050259f 100644
--- a/arch/mips/include/asm/pgalloc.h
+++ b/arch/mips/include/asm/pgalloc.h
@@ -59,15 +59,20 @@ do { \
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
{
- pmd_t *pmd = NULL;
+ pmd_t *pmd;
struct page *pg;
- pg = alloc_pages(GFP_KERNEL | __GFP_ACCOUNT, PMD_ORDER);
- if (pg) {
- pgtable_pmd_page_ctor(pg);
- pmd = (pmd_t *)page_address(pg);
- pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
+ pg = alloc_pages(GFP_KERNEL_ACCOUNT, PMD_ORDER);
+ if (!pg)
+ return NULL;
+
+ 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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] MIPS: check return value of pgtable_pmd_page_ctor
2021-07-21 5:20 ` [PATCH] MIPS: check return value of pgtable_pmd_page_ctor Huang Pei
@ 2021-07-21 9:03 ` Thomas Bogendoerfer
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2021-07-21 9:03 UTC (permalink / raw)
To: Huang Pei
Cc: ambrosehua, Bibo Mao, linux-mips, Jiaxun Yang, Paul Burton,
Li Xuefeng, Yang Tiezhu, Gao Juxin, Huacai Chen, Jinyang He,
Joshua Kinard
On Wed, Jul 21, 2021 at 01:20:23PM +0800, Huang Pei wrote:
> +. 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
>
> Reported-by: Joshua Kinard <kumba@gentoo.org>
> Signed-off-by: Huang Pei <huangpei@loongson.cn>
do we need a Fixes tag ?
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-21 9:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 5:20 [PATCH V2]: check return value of pgtalbe_pmd_page_ctor Huang Pei
2021-07-21 5:20 ` [PATCH] MIPS: check return value of pgtable_pmd_page_ctor Huang Pei
2021-07-21 9:03 ` Thomas Bogendoerfer
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).