* [PATCH] [v2] arm64: hugetlbpage: avoid unused-but-set-parameter warning (gcc-16)
@ 2026-02-13 16:22 Arnd Bergmann
2026-02-16 6:31 ` Dev Jain
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2026-02-13 16:22 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon
Cc: Arnd Bergmann, Andrew Morton, Ryan Roberts, Anshuman Khandual,
Rohan McLure, Kevin Brodsky, Baolin Wang, Alistair Popple,
Andrew Donnellan, linux-arm-kernel, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
gcc-16 warns about an instance that older compilers did not:
arch/arm64/mm/hugetlbpage.c: In function 'huge_pte_clear':
arch/arm64/mm/hugetlbpage.c:369:57: error: parameter 'addr' set but not used [-Werror=unused-but-set-parameter=]
The issue here is that __pte_clear() does not actually use its second
argument when CONFIG_ARM64_CONTPTE is disabled.
Replace the macro with an inline function to let the compiler see
how the argument is used.
Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: replace my original patch with Catalin's suggestion
---
arch/arm64/include/asm/pgtable.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index a17eb8a76788..b3e58735c49b 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -144,8 +144,6 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys)
__pte(__phys_to_pte_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
#define pte_none(pte) (!pte_val(pte))
-#define __pte_clear(mm, addr, ptep) \
- __set_pte(ptep, __pte(0))
#define pte_page(pte) (pfn_to_page(pte_pfn(pte)))
/*
@@ -1284,6 +1282,13 @@ static inline bool pud_user_accessible_page(pud_t pud, unsigned long addr)
/*
* Atomic pte/pmd modifications.
*/
+
+static inline void __pte_clear(struct mm_struct *mm,
+ unsigned long addr, pte_t *ptep)
+{
+ __set_pte(ptep, __pte(0));
+}
+
static inline int __ptep_test_and_clear_young(struct vm_area_struct *vma,
unsigned long address,
pte_t *ptep)
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [v2] arm64: hugetlbpage: avoid unused-but-set-parameter warning (gcc-16)
2026-02-13 16:22 [PATCH] [v2] arm64: hugetlbpage: avoid unused-but-set-parameter warning (gcc-16) Arnd Bergmann
@ 2026-02-16 6:31 ` Dev Jain
2026-02-16 11:48 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Dev Jain @ 2026-02-16 6:31 UTC (permalink / raw)
To: Arnd Bergmann, Catalin Marinas, Will Deacon
Cc: Arnd Bergmann, Andrew Morton, Ryan Roberts, Anshuman Khandual,
Rohan McLure, Kevin Brodsky, Baolin Wang, Alistair Popple,
Andrew Donnellan, linux-arm-kernel, linux-kernel
On 13/02/26 9:52 pm, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> gcc-16 warns about an instance that older compilers did not:
>
> arch/arm64/mm/hugetlbpage.c: In function 'huge_pte_clear':
> arch/arm64/mm/hugetlbpage.c:369:57: error: parameter 'addr' set but not used [-Werror=unused-but-set-parameter=]
>
> The issue here is that __pte_clear() does not actually use its second
> argument when CONFIG_ARM64_CONTPTE is disabled.
But that is true even when the config is on? __pte_clear has an unconditional definition.
>
> Replace the macro with an inline function to let the compiler see
> how the argument is used.
>
> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: replace my original patch with Catalin's suggestion
> ---
> arch/arm64/include/asm/pgtable.h | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index a17eb8a76788..b3e58735c49b 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -144,8 +144,6 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys)
> __pte(__phys_to_pte_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
>
> #define pte_none(pte) (!pte_val(pte))
> -#define __pte_clear(mm, addr, ptep) \
> - __set_pte(ptep, __pte(0))
> #define pte_page(pte) (pfn_to_page(pte_pfn(pte)))
>
> /*
> @@ -1284,6 +1282,13 @@ static inline bool pud_user_accessible_page(pud_t pud, unsigned long addr)
> /*
> * Atomic pte/pmd modifications.
> */
> +
> +static inline void __pte_clear(struct mm_struct *mm,
> + unsigned long addr, pte_t *ptep)
> +{
> + __set_pte(ptep, __pte(0));
> +}
> +
> static inline int __ptep_test_and_clear_young(struct vm_area_struct *vma,
> unsigned long address,
> pte_t *ptep)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [v2] arm64: hugetlbpage: avoid unused-but-set-parameter warning (gcc-16)
2026-02-16 6:31 ` Dev Jain
@ 2026-02-16 11:48 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2026-02-16 11:48 UTC (permalink / raw)
To: Dev Jain, Arnd Bergmann, Catalin Marinas, Will Deacon
Cc: Andrew Morton, Ryan Roberts, Anshuman Khandual, Rohan McLure,
Kevin Brodsky, Baolin Wang, Alistair Popple, Andrew Donnellan,
linux-arm-kernel, linux-kernel
On Mon, Feb 16, 2026, at 07:31, Dev Jain wrote:
> On 13/02/26 9:52 pm, Arnd Bergmann wrote:
>>
>> The issue here is that __pte_clear() does not actually use its second
>> argument when CONFIG_ARM64_CONTPTE is disabled.
>
> But that is true even when the config is on? __pte_clear has an
> unconditional definition.
>
No, you're right. I'll rephrase the changelog and send a v3.
When CONFIG_ARM64_CONTPTE is disabled, the warning doesn't
appear because the argument is unused by never changed as the
loop collapses into a single call.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-16 11:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-13 16:22 [PATCH] [v2] arm64: hugetlbpage: avoid unused-but-set-parameter warning (gcc-16) Arnd Bergmann
2026-02-16 6:31 ` Dev Jain
2026-02-16 11:48 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox