linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>, linuxppc-dev@lists.ozlabs.org
Cc: linux-mm@kvack.org, mike.kravetz@oracle.com
Subject: Re: [PATCH 1/2] powerpc/mm/64s: Drop pgd_huge()
Date: Sun, 04 Sep 2022 22:27:11 +0530	[thread overview]
Message-ID: <877d2jaxi0.fsf@linux.ibm.com> (raw)
In-Reply-To: <20220903123640.719846-1-mpe@ellerman.id.au>

Michael Ellerman <mpe@ellerman.id.au> writes:

>
> On powerpc there are two ways for huge pages to be represented in the
> top level page table, aka PGD (Page Global Directory).
>
> If the address space mapped by an individual PGD entry does not
> correspond to a given huge page size, then the PGD entry points to a
> non-standard page table, known as a "hugepd" (Huge Page Directory).
> The hugepd contains some number of huge page PTEs sufficient to map the
> address space with the given huge page size.
>
> On the other hand, if the address space mapped by an individual PGD
> entry does correspond exactly to a given huge page size, that PGD entry
> is used to directly encode the huge page PTE in place. In this case the
> pgd_huge() wrapper indicates to generic code that the PGD entry is
> actually a huge page PTE.
>
> This commit deals with the pgd_huge() case only, it does nothing with
> respect to the hugepd case.
>
> Over time the size of the virtual address space supported on powerpc has
> increased several times, which means the location at which huge pages
> can sit in the tree has also changed. There have also been new huge page
> sizes added, with the introduction of the Radix MMU.
>
> On Power9 and later with the Radix MMU, the largest huge page size in
> any implementation is 1GB.
>
> Since the introduction of Radix, 1GB entries have been supported at the
> PUD level, with both 4K and 64K base page size. Radix has never had a
> supported huge page size at the PGD level.
>
> On Power8 or earlier, which uses the Hash MMU, or Power9 or later with
> the Hash MMU enabled, the largest huge page size is 16GB.
>
> Using the Hash MMU and a base page size of 4K, 16GB has never been a
> supported huge page size at the PGD level, due to the geometry being
> incompatible. The two supported huge page sizes (16M & 16GB) both use
> the hugepd format.
>
> Using the Hash MMU and a base page size of 64K, 16GB pages were
> supported in the past at the PGD level.
>
> However in commit ba95b5d03596 ("powerpc/mm/book3s/64: Rework page table
> geometry for lower memory usage") the page table layout was reworked to
> shrink the size of the PGD.
>
> As a result the 16GB page size now fits at the PUD level when using 64K
> base page size.
>
> Therefore there are no longer any supported configurations where
> pgd_huge() can be true, so drop the definitions for pgd_huge(), and
> fallback to the generic definition which is always false.
>

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>

> Fixes: ba95b5d03596 ("powerpc/mm/book3s/64: Rework page table geometry for lower memory usage")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>  arch/powerpc/include/asm/book3s/64/pgtable-4k.h  | 10 ----------
>  arch/powerpc/include/asm/book3s/64/pgtable-64k.h |  9 ---------
>  2 files changed, 19 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/pgtable-4k.h b/arch/powerpc/include/asm/book3s/64/pgtable-4k.h
> index 4e697bc2f4cd..48f21820afe2 100644
> --- a/arch/powerpc/include/asm/book3s/64/pgtable-4k.h
> +++ b/arch/powerpc/include/asm/book3s/64/pgtable-4k.h
> @@ -26,16 +26,6 @@ static inline int pud_huge(pud_t pud)
>  	return 0;
>  }
>  
> -static inline int pgd_huge(pgd_t pgd)
> -{
> -	/*
> -	 * leaf pte for huge page
> -	 */
> -	if (radix_enabled())
> -		return !!(pgd_raw(pgd) & cpu_to_be64(_PAGE_PTE));
> -	return 0;
> -}
> -#define pgd_huge pgd_huge
>  /*
>   * With radix , we have hugepage ptes in the pud and pmd entries. We don't
>   * need to setup hugepage directory for them. Our pte and page directory format
> diff --git a/arch/powerpc/include/asm/book3s/64/pgtable-64k.h b/arch/powerpc/include/asm/book3s/64/pgtable-64k.h
> index 34d1018896b3..2fce3498b000 100644
> --- a/arch/powerpc/include/asm/book3s/64/pgtable-64k.h
> +++ b/arch/powerpc/include/asm/book3s/64/pgtable-64k.h
> @@ -30,15 +30,6 @@ static inline int pud_huge(pud_t pud)
>  	return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE));
>  }
>  
> -static inline int pgd_huge(pgd_t pgd)
> -{
> -	/*
> -	 * leaf pte for huge page
> -	 */
> -	return !!(pgd_raw(pgd) & cpu_to_be64(_PAGE_PTE));
> -}
> -#define pgd_huge pgd_huge
> -
>  /*
>   * With 64k page size, we have hugepage ptes in the pgd and pmd entries. We don't
>   * need to setup hugepage directory for them. Our pte and page directory format
> -- 
> 2.37.2

  parent reply	other threads:[~2022-09-04 16:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-03 12:36 [PATCH 1/2] powerpc/mm/64s: Drop pgd_huge() Michael Ellerman
2022-09-03 12:36 ` [PATCH 2/2] powerpc/mm/64s: Drop p4d_leaf() Michael Ellerman
2022-09-03 15:11   ` Christophe Leroy
2022-09-04 11:32     ` Michael Ellerman
2022-09-04 16:57   ` Aneesh Kumar K.V
2022-09-03 15:06 ` [PATCH 1/2] powerpc/mm/64s: Drop pgd_huge() Christophe Leroy
2022-09-04 11:24   ` Michael Ellerman
2022-09-04 16:57 ` Aneesh Kumar K.V [this message]
2022-10-04 13:24 ` Michael Ellerman

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=877d2jaxi0.fsf@linux.ibm.com \
    --to=aneesh.kumar@linux.ibm.com \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mike.kravetz@oracle.com \
    --cc=mpe@ellerman.id.au \
    /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).