* [PATCH V2]: MIPS: add PMD table accounting into
@ 2021-06-11 7:09 Huang Pei
2021-06-11 7:09 ` [PATCH] MIPS: add PMD table accounting into MIPS'pmd_alloc_one Huang Pei
0 siblings, 1 reply; 6+ messages in thread
From: Huang Pei @ 2021-06-11 7:09 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:
+. handle pmd page allocation failure;
+. add __GFP_ACCOUNT in pace with pte page table allocation;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] MIPS: add PMD table accounting into MIPS'pmd_alloc_one
2021-06-11 7:09 [PATCH V2]: MIPS: add PMD table accounting into Huang Pei
@ 2021-06-11 7:09 ` Huang Pei
2021-06-21 9:46 ` Thomas Bogendoerfer
0 siblings, 1 reply; 6+ messages in thread
From: Huang Pei @ 2021-06-11 7:09 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
This fixes Page Table accounting bug.
MIPS is the ONLY arch just defining __HAVE_ARCH_PMD_ALLOC_ONE alone.
Since commit b2b29d6d011944 (mm: account PMD tables like PTE tables),
"pmd_free" in asm-generic with PMD table accounting and "pmd_alloc_one"
in MIPS without PMD table accounting causes PageTable accounting number
negative, which read by global_zone_page_state(), always returns 0.
Signed-off-by: Huang Pei <huangpei@loongson.cn>
---
arch/mips/include/asm/pgalloc.h | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
index 8b18424b3120..d0cf997b4ba8 100644
--- a/arch/mips/include/asm/pgalloc.h
+++ b/arch/mips/include/asm/pgalloc.h
@@ -59,11 +59,15 @@ do { \
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
{
- pmd_t *pmd;
+ pmd_t *pmd = NULL;
+ struct page *pg;
- pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ORDER);
- if (pmd)
+ 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);
+ }
return pmd;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] MIPS: add PMD table accounting into MIPS'pmd_alloc_one
2021-06-11 7:09 ` [PATCH] MIPS: add PMD table accounting into MIPS'pmd_alloc_one Huang Pei
@ 2021-06-21 9:46 ` Thomas Bogendoerfer
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Bogendoerfer @ 2021-06-21 9:46 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
On Fri, Jun 11, 2021 at 03:09:46PM +0800, Huang Pei wrote:
> This fixes Page Table accounting bug.
>
> MIPS is the ONLY arch just defining __HAVE_ARCH_PMD_ALLOC_ONE alone.
> Since commit b2b29d6d011944 (mm: account PMD tables like PTE tables),
> "pmd_free" in asm-generic with PMD table accounting and "pmd_alloc_one"
> in MIPS without PMD table accounting causes PageTable accounting number
> negative, which read by global_zone_page_state(), always returns 0.
>
> Signed-off-by: Huang Pei <huangpei@loongson.cn>
> ---
> arch/mips/include/asm/pgalloc.h | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
applied to mips-next.
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] 6+ messages in thread
* Re: [PATCH] MIPS: add PMD table accounting into MIPS'pmd_alloc_one
2021-06-11 5:52 ` Jinyang He
@ 2021-06-11 6:00 ` 黄沛
0 siblings, 0 replies; 6+ messages in thread
From: 黄沛 @ 2021-06-11 6:00 UTC (permalink / raw)
To: Jinyang He, Thomas Bogendoerfer, ambrosehua
Cc: Bibo Mao, linux-mips, Jiaxun Yang, Paul Burton, Li Xuefeng,
Yang Tiezhu, Gao Juxin, Huacai Chen
yes,my bad,I will resend soon
Original Message
From: Jinyang He
Sent: 2021年6月11日星期五 13:52
To: Huang Pei; Thomas Bogendoerfer; ambrosehua@gmail.com
Cc: Bibo Mao; linux-mips@vger.kernel.org; Jiaxun Yang; Paul Burton; Li Xuefeng; Yang Tiezhu; Gao Juxin; Huacai Chen
Subject: Re: [PATCH] MIPS: add PMD table accounting into MIPS'pmd_alloc_one
On 06/11/2021 10:12 AM, Huang Pei wrote:
> This fixes Page Table accounting bug.
>
> MIPS is the ONLY arch just defining __HAVE_ARCH_PMD_ALLOC_ONE alone.
> Since commit b2b29d6d011944 (mm: account PMD tables like PTE tables),
> "pmd_free" in asm-generic with PMD table accounting and "pmd_alloc_one"
> in MIPS without PMD table accounting causes PageTable accounting number
> negative, which read by global_zone_page_state(), always returns 0.
>
> Signed-off-by: Huang Pei <huangpei@loongson.cn>
> ---
> arch/mips/include/asm/pgalloc.h | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
> index 8b18424b3120..916bd637d30f 100644
> --- a/arch/mips/include/asm/pgalloc.h
> +++ b/arch/mips/include/asm/pgalloc.h
> @@ -60,10 +60,14 @@ do { \
> static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
> {
> pmd_t *pmd;
pmd_t *pmd = NULL;
Does it needed?
Thanks,
Jinyang
> + struct page *pg;
>
> - pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ORDER);
> - if (pmd)
> + pg = alloc_pages(GFP_KERNEL, 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);
> + }
> return pmd;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] MIPS: add PMD table accounting into MIPS'pmd_alloc_one
2021-06-11 2:12 Huang Pei
@ 2021-06-11 5:52 ` Jinyang He
2021-06-11 6:00 ` 黄沛
0 siblings, 1 reply; 6+ messages in thread
From: Jinyang He @ 2021-06-11 5:52 UTC (permalink / raw)
To: Huang Pei, Thomas Bogendoerfer, ambrosehua
Cc: Bibo Mao, linux-mips, Jiaxun Yang, Paul Burton, Li Xuefeng,
Yang Tiezhu, Gao Juxin, Huacai Chen
On 06/11/2021 10:12 AM, Huang Pei wrote:
> This fixes Page Table accounting bug.
>
> MIPS is the ONLY arch just defining __HAVE_ARCH_PMD_ALLOC_ONE alone.
> Since commit b2b29d6d011944 (mm: account PMD tables like PTE tables),
> "pmd_free" in asm-generic with PMD table accounting and "pmd_alloc_one"
> in MIPS without PMD table accounting causes PageTable accounting number
> negative, which read by global_zone_page_state(), always returns 0.
>
> Signed-off-by: Huang Pei <huangpei@loongson.cn>
> ---
> arch/mips/include/asm/pgalloc.h | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
> index 8b18424b3120..916bd637d30f 100644
> --- a/arch/mips/include/asm/pgalloc.h
> +++ b/arch/mips/include/asm/pgalloc.h
> @@ -60,10 +60,14 @@ do { \
> static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
> {
> pmd_t *pmd;
pmd_t *pmd = NULL;
Does it needed?
Thanks,
Jinyang
> + struct page *pg;
>
> - pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ORDER);
> - if (pmd)
> + pg = alloc_pages(GFP_KERNEL, 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);
> + }
> return pmd;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] MIPS: add PMD table accounting into MIPS'pmd_alloc_one
@ 2021-06-11 2:12 Huang Pei
2021-06-11 5:52 ` Jinyang He
0 siblings, 1 reply; 6+ messages in thread
From: Huang Pei @ 2021-06-11 2:12 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
This fixes Page Table accounting bug.
MIPS is the ONLY arch just defining __HAVE_ARCH_PMD_ALLOC_ONE alone.
Since commit b2b29d6d011944 (mm: account PMD tables like PTE tables),
"pmd_free" in asm-generic with PMD table accounting and "pmd_alloc_one"
in MIPS without PMD table accounting causes PageTable accounting number
negative, which read by global_zone_page_state(), always returns 0.
Signed-off-by: Huang Pei <huangpei@loongson.cn>
---
arch/mips/include/asm/pgalloc.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
index 8b18424b3120..916bd637d30f 100644
--- a/arch/mips/include/asm/pgalloc.h
+++ b/arch/mips/include/asm/pgalloc.h
@@ -60,10 +60,14 @@ do { \
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
{
pmd_t *pmd;
+ struct page *pg;
- pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ORDER);
- if (pmd)
+ pg = alloc_pages(GFP_KERNEL, 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);
+ }
return pmd;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-06-21 9:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 7:09 [PATCH V2]: MIPS: add PMD table accounting into Huang Pei
2021-06-11 7:09 ` [PATCH] MIPS: add PMD table accounting into MIPS'pmd_alloc_one Huang Pei
2021-06-21 9:46 ` Thomas Bogendoerfer
-- strict thread matches above, loose matches on Subject: below --
2021-06-11 2:12 Huang Pei
2021-06-11 5:52 ` Jinyang He
2021-06-11 6:00 ` 黄沛
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.