linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] arm64: mm: Test for pmd_sect() in vmemmap_check_pmd()
@ 2025-01-02  7:40 Zhenhua Huang
  2025-01-03  7:06 ` Anshuman Khandual
  2025-01-08 16:38 ` Will Deacon
  0 siblings, 2 replies; 3+ messages in thread
From: Zhenhua Huang @ 2025-01-02  7:40 UTC (permalink / raw)
  To: anshuman.khandual, catalin.marinas
  Cc: will, ardb, ryan.roberts, mark.rutland, joey.gouly, dave.hansen,
	akpm, chenfeiyang, chenhuacai, linux-mm, linux-arm-kernel,
	linux-kernel, quic_tingweiz, Zhenhua Huang

Commit 2045a3b8911b ("mm/sparse-vmemmap: generalise vmemmap_populate_hugepages()")
introduces the vmemmap_check_pmd() while does not verify if the entry is a
section mapping, as is already done for Loongarch & X86.
The update includes a check for pmd_sect(). Only if pmd_sect() returns true,
further vmemmap population for the addr is skipped.

Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
---
Separate the patch out based on the discussion:
https://lore.kernel.org/linux-arm-kernel/20241209094227.1529977-3-quic_zhenhuah@quicinc.com/T/#m41d49cd91b348ecfe2c37c4b3c0911180426934e
 
 arch/arm64/mm/mmu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 9afeb35673a3..50a22c63f450 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -1172,7 +1172,8 @@ int __meminit vmemmap_check_pmd(pmd_t *pmdp, int node,
 				unsigned long addr, unsigned long next)
 {
 	vmemmap_verify((pte_t *)pmdp, node, addr, next);
-	return 1;
+
+	return pmd_sect(READ_ONCE(*pmdp));
 }
 
 int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
-- 
2.25.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] arm64: mm: Test for pmd_sect() in vmemmap_check_pmd()
  2025-01-02  7:40 [PATCH v3] arm64: mm: Test for pmd_sect() in vmemmap_check_pmd() Zhenhua Huang
@ 2025-01-03  7:06 ` Anshuman Khandual
  2025-01-08 16:38 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Anshuman Khandual @ 2025-01-03  7:06 UTC (permalink / raw)
  To: Zhenhua Huang, catalin.marinas
  Cc: will, ardb, ryan.roberts, mark.rutland, joey.gouly, dave.hansen,
	akpm, chenfeiyang, chenhuacai, linux-mm, linux-arm-kernel,
	linux-kernel, quic_tingweiz



On 1/2/25 13:10, Zhenhua Huang wrote:
> Commit 2045a3b8911b ("mm/sparse-vmemmap: generalise vmemmap_populate_hugepages()")
> introduces the vmemmap_check_pmd() while does not verify if the entry is a
> section mapping, as is already done for Loongarch & X86.
> The update includes a check for pmd_sect(). Only if pmd_sect() returns true,
> further vmemmap population for the addr is skipped.
> 
> Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
> ---
> Separate the patch out based on the discussion:
> https://lore.kernel.org/linux-arm-kernel/20241209094227.1529977-3-quic_zhenhuah@quicinc.com/T/#m41d49cd91b348ecfe2c37c4b3c0911180426934e

LGTM, regardless whether this patch goes on its own or via the series.

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

>  
>  arch/arm64/mm/mmu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 9afeb35673a3..50a22c63f450 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -1172,7 +1172,8 @@ int __meminit vmemmap_check_pmd(pmd_t *pmdp, int node,
>  				unsigned long addr, unsigned long next)
>  {
>  	vmemmap_verify((pte_t *)pmdp, node, addr, next);
> -	return 1;
> +
> +	return pmd_sect(READ_ONCE(*pmdp));
>  }
>  
>  int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] arm64: mm: Test for pmd_sect() in vmemmap_check_pmd()
  2025-01-02  7:40 [PATCH v3] arm64: mm: Test for pmd_sect() in vmemmap_check_pmd() Zhenhua Huang
  2025-01-03  7:06 ` Anshuman Khandual
@ 2025-01-08 16:38 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2025-01-08 16:38 UTC (permalink / raw)
  To: anshuman.khandual, catalin.marinas, Zhenhua Huang
  Cc: kernel-team, Will Deacon, ardb, ryan.roberts, mark.rutland,
	joey.gouly, dave.hansen, akpm, chenfeiyang, chenhuacai, linux-mm,
	linux-arm-kernel, linux-kernel, quic_tingweiz

On Thu, 02 Jan 2025 15:40:47 +0800, Zhenhua Huang wrote:
> Commit 2045a3b8911b ("mm/sparse-vmemmap: generalise vmemmap_populate_hugepages()")
> introduces the vmemmap_check_pmd() while does not verify if the entry is a
> section mapping, as is already done for Loongarch & X86.
> The update includes a check for pmd_sect(). Only if pmd_sect() returns true,
> further vmemmap population for the addr is skipped.
> 
> 
> [...]

Applied to arm64 (for-next/mm), thanks!

[1/1] arm64: mm: Test for pmd_sect() in vmemmap_check_pmd()
      https://git.kernel.org/arm64/c/9ab2601dc4c1

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-08 16:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-02  7:40 [PATCH v3] arm64: mm: Test for pmd_sect() in vmemmap_check_pmd() Zhenhua Huang
2025-01-03  7:06 ` Anshuman Khandual
2025-01-08 16:38 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox