linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Gavin Shan <gshan@redhat.com>, linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com,
	will@kernel.org, shan.gavin@gmail.com
Subject: Re: [PATCH v2 3/3] arm64/mm: Unitify CONT_PMD_SHIFT
Date: Fri, 11 Sep 2020 12:35:42 +0530	[thread overview]
Message-ID: <1af39001-8d8f-b573-8159-666999d25543@arm.com> (raw)
In-Reply-To: <20200910095936.20307-3-gshan@redhat.com>



On 09/10/2020 03:29 PM, Gavin Shan wrote:
> Similar to how CONT_PTE_SHIFT is determined, this introduces a new
> kernel option (CONFIG_CONT_PMD_SHIFT) to determine CONT_PMD_SHIFT.
> 
> Signed-off-by: Gavin Shan <gshan@redhat.com>
> ---
>  arch/arm64/Kconfig                     |  6 ++++++
>  arch/arm64/include/asm/pgtable-hwdef.h | 10 ++--------
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 7ec30dd56300..d58e17fe9473 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -217,6 +217,12 @@ config ARM64_CONT_PTE_SHIFT
>  	default 7 if ARM64_16K_PAGES
>  	default 4
>  
> +config ARM64_CONT_PMD_SHIFT
> +	int
> +	default 5 if ARM64_64K_PAGES
> +	default 5 if ARM64_16K_PAGES
> +	default 4
> +
>  config ARCH_MMAP_RND_BITS_MIN
>         default 14 if ARM64_64K_PAGES
>         default 16 if ARM64_16K_PAGES
> diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h
> index 6c9c67f62551..94b3f2ac2e9d 100644
> --- a/arch/arm64/include/asm/pgtable-hwdef.h
> +++ b/arch/arm64/include/asm/pgtable-hwdef.h
> @@ -82,17 +82,11 @@
>   * Contiguous page definitions.
>   */
>  #define CONT_PTE_SHIFT		(CONFIG_ARM64_CONT_PTE_SHIFT + PAGE_SHIFT)
> -#ifdef CONFIG_ARM64_64K_PAGES
> -#define CONT_PMD_SHIFT		(5 + PMD_SHIFT)
> -#elif defined(CONFIG_ARM64_16K_PAGES)
> -#define CONT_PMD_SHIFT		(5 + PMD_SHIFT)
> -#else
> -#define CONT_PMD_SHIFT		(4 + PMD_SHIFT)
> -#endif
> -
>  #define CONT_PTES		(1 << (CONT_PTE_SHIFT - PAGE_SHIFT))
>  #define CONT_PTE_SIZE		(CONT_PTES * PAGE_SIZE)
>  #define CONT_PTE_MASK		(~(CONT_PTE_SIZE - 1))
> +
> +#define CONT_PMD_SHIFT		(CONFIG_ARM64_CONT_PMD_SHIFT + PMD_SHIFT)
>  #define CONT_PMDS		(1 << (CONT_PMD_SHIFT - PMD_SHIFT))
>  #define CONT_PMD_SIZE		(CONT_PMDS * PMD_SIZE)
>  #define CONT_PMD_MASK		(~(CONT_PMD_SIZE - 1))
> 

This is cleaner and more uniform. Did not see any problem while
running some quick hugetlb tests across multiple page size configs
after applying all patches in this series.

Adding this new configuration ARM64_CONT_PMD_SHIFT makes sense, as
it eliminates existing constant values that are used in an ad hoc
manner, while computing contiguous page table entry properties.

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

  reply	other threads:[~2020-09-11  7:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10  9:59 [PATCH v2 1/3] arm64/mm: Remove CONT_RANGE_OFFSET Gavin Shan
2020-09-10  9:59 ` [PATCH v2 2/3] arm64/mm: Unitify CONT_PTE_SHIFT Gavin Shan
2020-09-11  7:00   ` Anshuman Khandual
2020-09-11 15:30   ` Catalin Marinas
2020-09-10  9:59 ` [PATCH v2 3/3] arm64/mm: Unitify CONT_PMD_SHIFT Gavin Shan
2020-09-11  7:05   ` Anshuman Khandual [this message]
2020-09-11 15:30   ` Catalin Marinas
2020-09-11 15:28 ` [PATCH v2 1/3] arm64/mm: Remove CONT_RANGE_OFFSET Catalin Marinas
2020-09-11 16:33 ` Will Deacon

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=1af39001-8d8f-b573-8159-666999d25543@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=gshan@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shan.gavin@gmail.com \
    --cc=will@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;
as well as URLs for NNTP newsgroup(s).