[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdWVrUgfXAud_3fpjfO-1yqXzf75Jtk6SNqqcR39-ZzQJA@mail.gmail.com>
Date: Tue, 8 Jun 2021 08:58:43 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Anshuman Khandual <anshuman.khandual@....com>
Cc: Linux MM <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Nick Hu <nickhu@...estech.com>,
Richard Henderson <rth@...ddle.net>,
Vineet Gupta <vgupta@...opsys.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Guo Ren <guoren@...nel.org>,
Brian Cain <bcain@...eaurora.org>,
Michal Simek <monstr@...str.eu>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Ley Foon Tan <ley.foon.tan@...el.com>,
Jonas Bonn <jonas@...thpole.se>,
Stefan Kristiansson <stefan.kristiansson@...nalahti.fi>,
Stafford Horne <shorne@...il.com>,
"James E.J. Bottomley" <James.Bottomley@...senpartnership.com>,
Michael Ellerman <mpe@...erman.id.au>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Heiko Carstens <hca@...ux.ibm.com>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
"David S. Miller" <davem@...emloft.net>,
Jeff Dike <jdike@...toit.com>,
Thomas Gleixner <tglx@...utronix.de>,
Chris Zankel <chris@...kel.net>,
Linux-Arch <linux-arch@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm/thp: Define default pmd_pgtable()
Hi Anshuman,
On Tue, Jun 8, 2021 at 7:31 AM Anshuman Khandual
<anshuman.khandual@....com> wrote:
> Currently most platforms define pmd_pgtable() as pmd_page() duplicating the
> same code all over. Instead just define a default value i.e pmd_page() for
> pmd_pgtable() and let platforms override when required via <asm/pgtable.h>.
> All the existing platform that override pmd_pgtable() have been moved into
> their respective <asm/pgtable.h> header in order to precede before the new
> generic definition. This makes it much cleaner with reduced code.
> Signed-off-by: Anshuman Khandual <anshuman.khandual@....com>
Thanks for your patch!
> This patch has been built tested across multiple platforms. But the m68k
> changes in particular might not be optimal, followed the existing switch
> from (arch/m68k/include/asm/pgalloc.h).
Indeed. Why not move them to the existing
arch/m68k/asm/{sun3,mcf,motorola}_pgtable.h>, instead of introducing
yet another #if/#elif/#else/#endif block?
> --- a/arch/m68k/include/asm/mcf_pgalloc.h
> +++ b/arch/m68k/include/asm/mcf_pgalloc.h
> @@ -32,8 +32,6 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
>
> #define pmd_populate_kernel pmd_populate
>
> -#define pmd_pgtable(pmd) pfn_to_virt(pmd_val(pmd) >> PAGE_SHIFT)
> -
> static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable,
> unsigned long address)
> {
> diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h
> index b4fc3b4f6bb3..74a817d9387f 100644
> --- a/arch/m68k/include/asm/motorola_pgalloc.h
> +++ b/arch/m68k/include/asm/motorola_pgalloc.h
> @@ -88,7 +88,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t page
> {
> pmd_set(pmd, page);
> }
> -#define pmd_pgtable(pmd) ((pgtable_t)pmd_page_vaddr(pmd))
>
> static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
> {
> diff --git a/arch/m68k/include/asm/pgtable.h b/arch/m68k/include/asm/pgtable.h
> index ad15d655a9bf..7be5e5e712b2 100644
> --- a/arch/m68k/include/asm/pgtable.h
> +++ b/arch/m68k/include/asm/pgtable.h
> @@ -4,3 +4,12 @@
> #else
> #include <asm/pgtable_mm.h>
> #endif
> +
> +
> +#if defined(CONFIG_COLDFIRE)
> +#define pmd_pgtable(pmd) pfn_to_virt(pmd_val(pmd) >> PAGE_SHIFT)
> +#elif defined(CONFIG_SUN3)
> +#define pmd_pgtable(pmd) pmd_page(pmd)
> +#else
> +#define pmd_pgtable(pmd) ((pgtable_t)pmd_page_vaddr(pmd))
> +#endif
> diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h
> index 000f64869b91..198036aff519 100644
> --- a/arch/m68k/include/asm/sun3_pgalloc.h
> +++ b/arch/m68k/include/asm/sun3_pgalloc.h
> @@ -32,7 +32,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t page
> {
> pmd_val(*pmd) = __pa((unsigned long)page_address(page));
> }
> -#define pmd_pgtable(pmd) pmd_page(pmd)
>
> /*
> * allocating and freeing a pmd is trivial: the 1-entry pmd is
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists