Re: [PATCH v2 5/6] mm: constify generic pte_get*()
"Lorenzo Stoakes (ARM)" <[email protected]> Tue, 4 Aug 2026 12:15:31 +0100
| Newsgroups | gmane.linux.ports.ppc.embedded,gmane.linux.ports.arm.kernel,gmane.linux.kernel,gmane.linux.ports.parisc,gmane.linux.kernel.mm,gmane.linux.file-systems |
|---|---|
| Message-ID | <anHJtpEpXWITllqk@lucifer> |
On Mon, Aug 03, 2026 at 05:43:59PM +0100, Pedro Falcato wrote: > None of the helpers need write access to the PTE. Constifying the param > allows for const typesafety. constity? > > Signed-off-by: Pedro Falcato <[email protected]> LGTM, so: Reviewed-by: Lorenzo Stoakes (ARM) <[email protected]> > --- > include/linux/pgtable.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h > index 8c093c119e5a..dc418553e57a 100644 > --- a/include/linux/pgtable.h > +++ b/include/linux/pgtable.h > @@ -490,7 +490,7 @@ 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); > } > @@ -739,7 +739,7 @@ static inline void ptep_clear(struct mm_struct *mm, unsigned long addr, > * present bit set *unless* it is 'l'. Because get_user_pages_fast() only > * operates on present ptes we're safe. > */ > -static inline pte_t ptep_get_lockless(pte_t *ptep) > +static inline pte_t ptep_get_lockless(const pte_t *ptep) > { > pte_t pte; > > @@ -777,7 +777,7 @@ static inline pmd_t pmdp_get_lockless(pmd_t *pmdp) > * We require that the PTE can be read atomically. > */ > #ifndef ptep_get_lockless > -static inline pte_t ptep_get_lockless(pte_t *ptep) > +static inline pte_t ptep_get_lockless(const pte_t *ptep) > { > return ptep_get(ptep); > } > -- > 2.55.0 > -- Cheers, Lorenzo