* [PATCH] mm: Constify arguments in default pxdp_get()
@ 2026-09-18 6:49 Anshuman Khandual
2026-09-18 12:10 ` David Hildenbrand (Arm)
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Anshuman Khandual @ 2026-09-18 6:49 UTC (permalink / raw)
To: linux-mm
Cc: Anshuman Khandual, Andrew Morton, David Hildenbrand,
Lorenzo Stoakes, linux-kernel
Generic MM default pxdp_get() helpers fetch the values contained in pgtable
entries via READ_ONCE() without modifying them. Just make their arguments
explicitly 'const' for some additional protection.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Suggested-by: David Hildenbrand <david@kernel.org>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This patch applies on v7.2-rc3 and builds on many platforms. Some earlier
discussion could be found here. Platorm implementations for these helpers
could convert into these "const" format later if required.
https://lore.kernel.org/all/yjqldpl7il6uqfoqrszaopchqthhlffssprmlqjkljvpkbpwkt@zetb5hyvllsl/
include/linux/pgtable.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index 2981e386da7b3..f09a91ff5833b 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -490,35 +490,35 @@ static inline int pudp_set_access_flags(struct vm_area_struct *vma,
#endif
#ifndef ptep_get
-static inline pte_t ptep_get(pte_t *ptep)
+static inline pte_t ptep_get(const pte_t *ptep)
{
return READ_ONCE(*ptep);
}
#endif
#ifndef pmdp_get
-static inline pmd_t pmdp_get(pmd_t *pmdp)
+static inline pmd_t pmdp_get(const pmd_t *pmdp)
{
return READ_ONCE(*pmdp);
}
#endif
#ifndef pudp_get
-static inline pud_t pudp_get(pud_t *pudp)
+static inline pud_t pudp_get(const pud_t *pudp)
{
return READ_ONCE(*pudp);
}
#endif
#ifndef p4dp_get
-static inline p4d_t p4dp_get(p4d_t *p4dp)
+static inline p4d_t p4dp_get(const p4d_t *p4dp)
{
return READ_ONCE(*p4dp);
}
#endif
#ifndef pgdp_get
-static inline pgd_t pgdp_get(pgd_t *pgdp)
+static inline pgd_t pgdp_get(const pgd_t *pgdp)
{
return READ_ONCE(*pgdp);
}
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: Constify arguments in default pxdp_get()
2026-09-18 6:49 [PATCH] mm: Constify arguments in default pxdp_get() Anshuman Khandual
@ 2026-09-18 12:10 ` David Hildenbrand (Arm)
2026-09-18 12:40 ` Pedro Falcato
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: David Hildenbrand (Arm) @ 2026-09-18 12:10 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm; +Cc: Andrew Morton, Lorenzo Stoakes, linux-kernel
On 9/18/26 08:49, Anshuman Khandual wrote:
> Generic MM default pxdp_get() helpers fetch the values contained in pgtable
> entries via READ_ONCE() without modifying them. Just make their arguments
> explicitly 'const' for some additional protection.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: David Hildenbrand <david@kernel.org>
> Cc: Lorenzo Stoakes <ljs@kernel.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Suggested-by: David Hildenbrand <david@kernel.org>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: Constify arguments in default pxdp_get()
2026-09-18 6:49 [PATCH] mm: Constify arguments in default pxdp_get() Anshuman Khandual
2026-09-18 12:10 ` David Hildenbrand (Arm)
@ 2026-09-18 12:40 ` Pedro Falcato
2026-09-18 13:22 ` Lorenzo Stoakes (ARM)
2026-09-19 1:00 ` SJ Park
3 siblings, 0 replies; 5+ messages in thread
From: Pedro Falcato @ 2026-09-18 12:40 UTC (permalink / raw)
To: Anshuman Khandual
Cc: linux-mm, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
linux-kernel
On Fri, Sep 18, 2026 at 12:19:28PM +0530, Anshuman Khandual wrote:
> Generic MM default pxdp_get() helpers fetch the values contained in pgtable
> entries via READ_ONCE() without modifying them. Just make their arguments
> explicitly 'const' for some additional protection.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: David Hildenbrand <david@kernel.org>
> Cc: Lorenzo Stoakes <ljs@kernel.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Suggested-by: David Hildenbrand <david@kernel.org>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
https://lore.kernel.org/linux-mm/20260803164400.531199-1-pfalcato@suse.de/
I'll respin my series, since it addresses every architecture.
(apologies for not doing it yet this merge window, but it has been hectic
downstream)
--
Pedro
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: Constify arguments in default pxdp_get()
2026-09-18 6:49 [PATCH] mm: Constify arguments in default pxdp_get() Anshuman Khandual
2026-09-18 12:10 ` David Hildenbrand (Arm)
2026-09-18 12:40 ` Pedro Falcato
@ 2026-09-18 13:22 ` Lorenzo Stoakes (ARM)
2026-09-19 1:00 ` SJ Park
3 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-09-18 13:22 UTC (permalink / raw)
To: Anshuman Khandual
Cc: linux-mm, Andrew Morton, David Hildenbrand, linux-kernel
On Fri, Sep 18, 2026 at 12:19:28PM +0530, Anshuman Khandual wrote:
> Generic MM default pxdp_get() helpers fetch the values contained in pgtable
> entries via READ_ONCE() without modifying them. Just make their arguments
> explicitly 'const' for some additional protection.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: David Hildenbrand <david@kernel.org>
> Cc: Lorenzo Stoakes <ljs@kernel.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Suggested-by: David Hildenbrand <david@kernel.org>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
LGTM so:
Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
> This patch applies on v7.2-rc3 and builds on many platforms. Some earlier
> discussion could be found here. Platorm implementations for these helpers
> could convert into these "const" format later if required.
>
> https://lore.kernel.org/all/yjqldpl7il6uqfoqrszaopchqthhlffssprmlqjkljvpkbpwkt@zetb5hyvllsl/
>
> include/linux/pgtable.h | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index 2981e386da7b3..f09a91ff5833b 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -490,35 +490,35 @@ static inline int pudp_set_access_flags(struct vm_area_struct *vma,
> #endif
>
> #ifndef ptep_get
> -static inline pte_t ptep_get(pte_t *ptep)
> +static inline pte_t ptep_get(const pte_t *ptep)
> {
> return READ_ONCE(*ptep);
> }
> #endif
>
> #ifndef pmdp_get
> -static inline pmd_t pmdp_get(pmd_t *pmdp)
> +static inline pmd_t pmdp_get(const pmd_t *pmdp)
> {
> return READ_ONCE(*pmdp);
> }
> #endif
>
> #ifndef pudp_get
> -static inline pud_t pudp_get(pud_t *pudp)
> +static inline pud_t pudp_get(const pud_t *pudp)
> {
> return READ_ONCE(*pudp);
> }
> #endif
>
> #ifndef p4dp_get
> -static inline p4d_t p4dp_get(p4d_t *p4dp)
> +static inline p4d_t p4dp_get(const p4d_t *p4dp)
> {
> return READ_ONCE(*p4dp);
> }
> #endif
>
> #ifndef pgdp_get
> -static inline pgd_t pgdp_get(pgd_t *pgdp)
> +static inline pgd_t pgdp_get(const pgd_t *pgdp)
> {
> return READ_ONCE(*pgdp);
> }
> --
> 2.43.0
>
--
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: Constify arguments in default pxdp_get()
2026-09-18 6:49 [PATCH] mm: Constify arguments in default pxdp_get() Anshuman Khandual
` (2 preceding siblings ...)
2026-09-18 13:22 ` Lorenzo Stoakes (ARM)
@ 2026-09-19 1:00 ` SJ Park
3 siblings, 0 replies; 5+ messages in thread
From: SJ Park @ 2026-09-19 1:00 UTC (permalink / raw)
To: Anshuman Khandual
Cc: SJ Park, linux-mm, Andrew Morton, David Hildenbrand,
Lorenzo Stoakes, linux-kernel
On Fri, 18 Sep 2026 12:19:28 +0530 Anshuman Khandual <anshuman.khandual@arm.com> wrote:
> Generic MM default pxdp_get() helpers fetch the values contained in pgtable
> entries via READ_ONCE() without modifying them. Just make their arguments
> explicitly 'const' for some additional protection.
Looks good and safe to me.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: David Hildenbrand <david@kernel.org>
> Cc: Lorenzo Stoakes <ljs@kernel.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Suggested-by: David Hildenbrand <david@kernel.org>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: SJ Park <sj@kernel.org>
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-19 1:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 6:49 [PATCH] mm: Constify arguments in default pxdp_get() Anshuman Khandual
2026-09-18 12:10 ` David Hildenbrand (Arm)
2026-09-18 12:40 ` Pedro Falcato
2026-09-18 13:22 ` Lorenzo Stoakes (ARM)
2026-09-19 1:00 ` SJ Park
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®