Re: [PATCH V2] mm/thp: Define default pmd_pgtable()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Anshuman,

On Wed, Jun 09, 2021 at 10:29:59AM +0530, Anshuman Khandual 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.
> 
> Cc: Nick Hu <nickhu@xxxxxxxxxxxxx>
> Cc: Richard Henderson <rth@xxxxxxxxxxx>
> Cc: Vineet Gupta <vgupta@xxxxxxxxxxxx>
> Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
> Cc: Will Deacon <will@xxxxxxxxxx>
> Cc: Guo Ren <guoren@xxxxxxxxxx>
> Cc: Brian Cain <bcain@xxxxxxxxxxxxxx>
> Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Cc: Michal Simek <monstr@xxxxxxxxx>
> Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>
> Cc: Ley Foon Tan <ley.foon.tan@xxxxxxxxx>
> Cc: Jonas Bonn <jonas@xxxxxxxxxxxx>
> Cc: Stefan Kristiansson <stefan.kristiansson@xxxxxxxxxxxxx>
> Cc: Stafford Horne <shorne@xxxxxxxxx>
> Cc: "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>
> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
> Cc: Christophe Leroy <christophe.leroy@xxxxxxxxxx>
> Cc: Paul Walmsley <paul.walmsley@xxxxxxxxxx>
> Cc: Palmer Dabbelt <palmer@xxxxxxxxxxx>
> Cc: Heiko Carstens <hca@xxxxxxxxxxxxx>
> Cc: Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>
> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
> Cc: Jeff Dike <jdike@xxxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Chris Zankel <chris@xxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: linux-arch@xxxxxxxxxxxxxxx
> Cc: linux-mm@xxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>

One nit below, otherwise

Acked-by: Mike Rapoport <rppt@xxxxxxxxxxxxx>

> ---
> This patch applies on linux-next (20210608) as there is a merge conflict
> dependency on the following commit.
> 
> 40762590e8be ("mm: define default value for FIRST_USER_ADDRESS").
> 
> This patch has been built tested across multiple platforms.
> 
> Changes in V2:
> 
> - Changed m68k per Geert
> 
> Changes in V1:
> 
> https://lore.kernel.org/linux-arch/1623130327-13325-1-git-send-email-anshuman.khandual@xxxxxxx/

...

> 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
> diff --git a/arch/m68k/include/asm/sun3_pgtable.h b/arch/m68k/include/asm/sun3_pgtable.h
> index 5b24283a0a42..127282bd8b96 100644
> --- a/arch/m68k/include/asm/sun3_pgtable.h
> +++ b/arch/m68k/include/asm/sun3_pgtable.h
> @@ -96,6 +96,8 @@
>  
>  #ifndef __ASSEMBLY__
>  
> +#define pmd_pgtable(pmd) pmd_page(pmd)
> +

Is this one really needed? Won't the generic definition work instead?

>  /*
>   * Conversion functions: convert a page and protection to a page entry,
>   * and a page entry and page directory to the page they refer to.
> diff --git a/arch/microblaze/include/asm/pgalloc.h b/arch/microblaze/include/asm/pgalloc.h
> index d56b9f670ad1..6c33b05f730f 100644
> --- a/arch/microblaze/include/asm/pgalloc.h
> +++ b/arch/microblaze/include/asm/pgalloc.h
> @@ -28,8 +28,6 @@ static inline pgd_t *get_pgd(void)
>  
>  #define pgd_alloc(mm)		get_pgd()
>  
> -#define pmd_pgtable(pmd)	pmd_page(pmd)
> -
>  extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm);
>  
>  #define __pte_free_tlb(tlb, pte, addr)	pte_free((tlb)->mm, (pte))

-- 
Sincerely yours,
Mike.



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux