From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Linux MM <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Nick Hu <nickhu@andestech.com>,
Richard Henderson <rth@twiddle.net>,
Vineet Gupta <vgupta@synopsys.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>, Guo Ren <guoren@kernel.org>,
Brian Cain <bcain@codeaurora.org>,
Michal Simek <monstr@monstr.eu>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Ley Foon Tan <ley.foon.tan@intel.com>,
Jonas Bonn <jonas@southpole.se>,
Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
Stafford Horne <shorne@gmail.com>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Heiko Carstens <hca@linux.ibm.com>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
"David S. Miller" <davem@davemloft.net>,
Jeff Dike <jdike@addtoit.com>,
Thomas Gleixner <tglx@linutronix.de>,
Chris Zankel <chris@zankel.net>,
Linux-Arch <linux-arch@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/thp: Define default pmd_pgtable()
Date: Tue, 8 Jun 2021 08:58:43 +0200 [thread overview]
Message-ID: <CAMuHMdWVrUgfXAud_3fpjfO-1yqXzf75Jtk6SNqqcR39-ZzQJA@mail.gmail.com> (raw)
In-Reply-To: <1623130327-13325-1-git-send-email-anshuman.khandual@arm.com>
Hi Anshuman,
On Tue, Jun 8, 2021 at 7:31 AM Anshuman Khandual
<anshuman.khandual@arm.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@arm.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@linux-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
next prev parent reply other threads:[~2021-06-08 6:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-08 5:32 [PATCH] mm/thp: Define default pmd_pgtable() Anshuman Khandual
2021-06-08 6:58 ` Geert Uytterhoeven [this message]
2021-06-08 7:48 ` Anshuman Khandual
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=CAMuHMdWVrUgfXAud_3fpjfO-1yqXzf75Jtk6SNqqcR39-ZzQJA@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=bcain@codeaurora.org \
--cc=catalin.marinas@arm.com \
--cc=chris@zankel.net \
--cc=christophe.leroy@csgroup.eu \
--cc=davem@davemloft.net \
--cc=guoren@kernel.org \
--cc=hca@linux.ibm.com \
--cc=jdike@addtoit.com \
--cc=jonas@southpole.se \
--cc=ley.foon.tan@intel.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=monstr@monstr.eu \
--cc=mpe@ellerman.id.au \
--cc=nickhu@andestech.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=rth@twiddle.net \
--cc=shorne@gmail.com \
--cc=stefan.kristiansson@saunalahti.fi \
--cc=tglx@linutronix.de \
--cc=tsbogend@alpha.franken.de \
--cc=vgupta@synopsys.com \
--cc=will@kernel.org \
--cc=ysato@users.sourceforge.jp \
/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 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).