linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: peterx@redhat.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	x86@kernel.org, "Kirill A . Shutemov" <kirill@shutemov.name>,
	Jason Gunthorpe <jgg@nvidia.com>, Yang Shi <shy828301@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linuxppc-dev@lists.ozlabs.org,
	Muchun Song <muchun.song@linux.dev>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@kernel.org>,
	"Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
Subject: Re: [PATCH v3 01/10] mm/ppc: Define pXd_large() with pXd_leaf()
Date: Wed, 6 Mar 2024 08:15:53 +0200	[thread overview]
Message-ID: <ZegKGU4kTV-icKKC@kernel.org> (raw)
In-Reply-To: <20240305043750.93762-2-peterx@redhat.com>

On Tue, Mar 05, 2024 at 12:37:41PM +0800, peterx@redhat.com wrote:
> From: Peter Xu <peterx@redhat.com>
> 
> The two definitions are the same.  The only difference is that pXd_large()
> is only defined with THP selected, and only on book3s 64bits.
> 
> Instead of implementing it twice, make pXd_large() a macro to pXd_leaf().
> Define it unconditionally just like pXd_leaf().  This helps to prepare
> merging the two APIs.
> 
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
> Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
> Cc: linuxppc-dev@lists.ozlabs.org
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>

Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>

> ---
>  arch/powerpc/include/asm/book3s/64/pgtable.h | 16 ++--------------
>  arch/powerpc/include/asm/pgtable.h           |  2 +-
>  2 files changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
> index 927d585652bc..d1318e8582ac 100644
> --- a/arch/powerpc/include/asm/book3s/64/pgtable.h
> +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
> @@ -1157,20 +1157,6 @@ pud_hugepage_update(struct mm_struct *mm, unsigned long addr, pud_t *pudp,
>  	return pud_val(*pudp);
>  }
>  
> -/*
> - * returns true for pmd migration entries, THP, devmap, hugetlb
> - * But compile time dependent on THP config
> - */
> -static inline int pmd_large(pmd_t pmd)
> -{
> -	return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE));
> -}
> -
> -static inline int pud_large(pud_t pud)
> -{
> -	return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE));
> -}
> -
>  /*
>   * For radix we should always find H_PAGE_HASHPTE zero. Hence
>   * the below will work for radix too
> @@ -1455,6 +1441,7 @@ static inline bool is_pte_rw_upgrade(unsigned long old_val, unsigned long new_va
>   */
>  #define pmd_is_leaf pmd_is_leaf
>  #define pmd_leaf pmd_is_leaf
> +#define pmd_large pmd_leaf
>  static inline bool pmd_is_leaf(pmd_t pmd)
>  {
>  	return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE));
> @@ -1462,6 +1449,7 @@ static inline bool pmd_is_leaf(pmd_t pmd)
>  
>  #define pud_is_leaf pud_is_leaf
>  #define pud_leaf pud_is_leaf
> +#define pud_large pud_leaf
>  static inline bool pud_is_leaf(pud_t pud)
>  {
>  	return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE));
> diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
> index 7a1ba8889aea..5928b3c1458d 100644
> --- a/arch/powerpc/include/asm/pgtable.h
> +++ b/arch/powerpc/include/asm/pgtable.h
> @@ -101,7 +101,7 @@ void poking_init(void);
>  extern unsigned long ioremap_bot;
>  extern const pgprot_t protection_map[16];
>  
> -#ifndef CONFIG_TRANSPARENT_HUGEPAGE
> +#ifndef pmd_large
>  #define pmd_large(pmd)		0
>  #endif
>  
> -- 
> 2.44.0
> 
> 

-- 
Sincerely yours,
Mike.


  parent reply	other threads:[~2024-03-06  6:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05  4:37 [PATCH v3 00/10] mm/treewide: Replace " peterx
2024-03-05  4:37 ` [PATCH v3 01/10] mm/ppc: Define " peterx
2024-03-05 17:29   ` Christophe Leroy
2024-03-06  6:15   ` Mike Rapoport [this message]
2024-03-05  4:37 ` [PATCH v3 02/10] mm/ppc: Replace pXd_is_leaf() " peterx
2024-03-05 17:31   ` Christophe Leroy
2024-03-06  6:20   ` Mike Rapoport
2024-03-05  4:37 ` [PATCH v3 03/10] mm/x86: Replace p4d_large() with p4d_leaf() peterx
2024-03-06  6:23   ` Mike Rapoport
2024-03-05  4:37 ` [PATCH v3 04/10] mm/x86: Replace pgd_large() with pgd_leaf() peterx
2024-03-05 16:05   ` Jason Gunthorpe
2024-03-06  6:23   ` Mike Rapoport
2024-03-05  4:37 ` [PATCH v3 05/10] mm/x86: Drop two unnecessary pud_leaf() definitions peterx
2024-03-06  6:27   ` Mike Rapoport
2024-03-05  4:37 ` [PATCH v3 06/10] mm/kasan: Use pXd_leaf() in shadow_mapped() peterx
2024-03-06  6:28   ` Mike Rapoport
2024-03-05  4:37 ` [PATCH v3 07/10] mm/treewide: Replace pmd_large() with pmd_leaf() peterx
2024-03-06  6:31   ` Mike Rapoport
2024-03-05  4:37 ` [PATCH v3 08/10] mm/treewide: Replace pud_large() with pud_leaf() peterx
2024-03-05  4:37 ` [PATCH v3 09/10] mm/treewide: Drop pXd_large() peterx
2024-03-06  6:34   ` Mike Rapoport
2024-03-05  4:37 ` [PATCH v3 10/10] mm/treewide: Align up pXd_leaf() retval across archs peterx
2024-03-05 14:33   ` Jason Gunthorpe
2024-03-06  6:35   ` Mike Rapoport

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=ZegKGU4kTV-icKKC@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=jgg@nvidia.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=muchun.song@linux.dev \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=peterx@redhat.com \
    --cc=shy828301@gmail.com \
    --cc=x86@kernel.org \
    /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