diff mbox series

[1/2] arm64/mm: Use generic __pud_free() helper in pud_free() implementation

Message ID 20240301104046.1234309-5-ardb+git@google.com (mailing list archive)
State New, archived
Headers show
Series arm64 lpa2 fixes | expand

Commit Message

Ard Biesheuvel March 1, 2024, 10:40 a.m. UTC
From: Ard Biesheuvel <ardb@kernel.org>

Commit 0dd4f60a2c76 ("arm64: mm: Add support for folding PUDs at
runtime") implements specialized PUD alloc/free helpers to allow the
decision whether or not to fold PUDs to be made at runtime when the
number of paging levels is 4 or higher.

Its implementation of pud_free() is based on the generic version that
existed when the patch was first written, but in the meantime, the
freeing of a PUD has become a bit more involved, and so instead of
simply freeing the page, we should invoke the generic __pud_free() that
encapsulates whatever needs doing at this point.

This fixes a reported warning emitted by the page flags
self-diagnostics.

Reported-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/arm64/include/asm/pgalloc.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Ryan Roberts March 1, 2024, 10:46 a.m. UTC | #1
On 01/03/2024 10:40, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
> 
> Commit 0dd4f60a2c76 ("arm64: mm: Add support for folding PUDs at
> runtime") implements specialized PUD alloc/free helpers to allow the
> decision whether or not to fold PUDs to be made at runtime when the
> number of paging levels is 4 or higher.
> 
> Its implementation of pud_free() is based on the generic version that
> existed when the patch was first written, but in the meantime, the
> freeing of a PUD has become a bit more involved, and so instead of
> simply freeing the page, we should invoke the generic __pud_free() that
> encapsulates whatever needs doing at this point.
> 
> This fixes a reported warning emitted by the page flags
> self-diagnostics.
> 
> Reported-by: Ryan Roberts <ryan.roberts@arm.com>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

Tested-by: Ryan Roberts <ryan.roberts@arm.com>

> ---
>  arch/arm64/include/asm/pgalloc.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h
> index aeba2cf15a25..8ff5f2a2579e 100644
> --- a/arch/arm64/include/asm/pgalloc.h
> +++ b/arch/arm64/include/asm/pgalloc.h
> @@ -60,8 +60,7 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud)
>  {
>  	if (!pgtable_l4_enabled())
>  		return;
> -	BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
> -	free_page((unsigned long)pud);
> +	__pud_free(mm, pud);
>  }
>  #else
>  static inline void __p4d_populate(p4d_t *p4dp, phys_addr_t pudp, p4dval_t prot)
diff mbox series

Patch

diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h
index aeba2cf15a25..8ff5f2a2579e 100644
--- a/arch/arm64/include/asm/pgalloc.h
+++ b/arch/arm64/include/asm/pgalloc.h
@@ -60,8 +60,7 @@  static inline void pud_free(struct mm_struct *mm, pud_t *pud)
 {
 	if (!pgtable_l4_enabled())
 		return;
-	BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
-	free_page((unsigned long)pud);
+	__pud_free(mm, pud);
 }
 #else
 static inline void __p4d_populate(p4d_t *p4dp, phys_addr_t pudp, p4dval_t prot)