mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64/mm: Drop use_1G_block()
Date: Wed, 16 Feb 2022 10:44:54 +0530	[thread overview]
Message-ID: <fbf2d9f5-2226-dbd8-af3b-096fa2020381@arm.com> (raw)
In-Reply-To: <1644988012-25455-1-git-send-email-anshuman.khandual@arm.com>



On 2/16/22 10:36 AM, Anshuman Khandual wrote:
> pud_sect_supported() already checks for PUD level block mapping support i.e
> on ARM64_4K_PAGES config. Hence pud_sect_supported(), along with some other
> required alignment checks can help completely drop use_1G_block().
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> This applies on v5.17-rc4
> 
>  arch/arm64/mm/mmu.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index acfae9b41cc8..5a7954c9e6ec 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -294,18 +294,6 @@ static void alloc_init_cont_pmd(pud_t *pudp, unsigned long addr,
>  	} while (addr = next, addr != end);
>  }
>  
> -static inline bool use_1G_block(unsigned long addr, unsigned long next,
> -			unsigned long phys)
> -{
> -	if (PAGE_SHIFT != 12)
> -		return false;
> -
> -	if (((addr | next | phys) & ~PUD_MASK) != 0)
> -		return false;
> -
> -	return true;
> -}
> -
>  static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
>  			   phys_addr_t phys, pgprot_t prot,
>  			   phys_addr_t (*pgtable_alloc)(int),
> @@ -338,7 +326,8 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
>  		/*
>  		 * For 4K granule only, attempt to put down a 1GB block
>  		 */
> -		if (use_1G_block(addr, next, phys) &&
> +		if (pud_sect_supported() &&
> +		   ((addr | next | phys) & ~PUD_MASK) == 0 &&
>  		    (flags & NO_BLOCK_MAPPINGS) == 0) {

This is now very similar to init_pmd() block mapping check.

>  			pud_set_huge(pudp, phys, prot);
>  
> 

  reply	other threads:[~2022-02-16  5:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16  5:06 Anshuman Khandual
2022-02-16  5:14 ` Anshuman Khandual [this message]
2022-03-07 16:37 ` Catalin Marinas
2022-03-07 22:03 ` 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=fbf2d9f5-2226-dbd8-af3b-096fa2020381@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®