All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jinyang He <hejinyang@loongson.cn>
To: Huang Pei <huangpei@loongson.cn>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	ambrosehua@gmail.com
Cc: Bibo Mao <maobibo@loongson.cn>,
	linux-mips@vger.kernel.org, Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Paul Burton <paulburton@kernel.org>,
	Li Xuefeng <lixuefeng@loongson.cn>,
	Yang Tiezhu <yangtiezhu@loongson.cn>,
	Gao Juxin <gaojuxin@loongson.cn>,
	Huacai Chen <chenhuacai@loongson.cn>
Subject: Re: [PATCH] MIPS: add PMD table accounting into MIPS'pmd_alloc_one
Date: Fri, 11 Jun 2021 13:52:46 +0800	[thread overview]
Message-ID: <bc494f2f-9593-ddfa-11bf-ef33d0a614ee@loongson.cn> (raw)
In-Reply-To: <20210611021235.2426442-1-huangpei@loongson.cn>

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;
>   }
>   


  reply	other threads:[~2021-06-11  5:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11  2:12 [PATCH] MIPS: add PMD table accounting into MIPS'pmd_alloc_one Huang Pei
2021-06-11  5:52 ` Jinyang He [this message]
2021-06-11  6:00   ` 黄沛
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc494f2f-9593-ddfa-11bf-ef33d0a614ee@loongson.cn \
    --to=hejinyang@loongson.cn \
    --cc=ambrosehua@gmail.com \
    --cc=chenhuacai@loongson.cn \
    --cc=gaojuxin@loongson.cn \
    --cc=huangpei@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-mips@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=maobibo@loongson.cn \
    --cc=paulburton@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.