On Tue, Sep 22, 2026 at 06:12:30PM +0100, Muhammad Usama Anjum wrote: > Some interfaces use pte_t * for a software PTE value rather than for an > entry stored in a PTE table. These pointers must remain pte_t * when > pointers to PTE table storage are converted to hw_pte_t *. > > Rename these parameters in the install_pte callback, > write_protect_page(), and guard_install_set_pte() to ptentp. The later > Coccinelle conversion skips pointers named ptentp, allowing it to convert > the remaining PTE table pointers without changing these interfaces. > > Some functions already use ptentp for such pointers, including: > - madvise_folio_pte_batch() > - folio_pte_batch_flags() > No need to rename them. > > This patch only renames parameters and makes no functional change. > > Acked-by: David Hildenbrand (Arm) <[email protected]> > Signed-off-by: Muhammad Usama Anjum <[email protected]>
Reviewed-by: Anshuman Khandual <[email protected]> > --- > Changes since v1: > - Rewrite the subject and description to distinguish software PTE > values from PTE table storage. > > Changes since RFC v1: > - Update the description for the architecture opt-in conversion. > --- > include/linux/pagewalk.h | 2 +- > mm/ksm.c | 4 ++-- > mm/madvise.c | 4 ++-- > 3 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/include/linux/pagewalk.h b/include/linux/pagewalk.h > index b41d7265c01bc..c34d826c5e4a2 100644 > --- a/include/linux/pagewalk.h > +++ b/include/linux/pagewalk.h > @@ -89,7 +89,7 @@ struct mm_walk_ops { > struct mm_walk *walk); > void (*post_vma)(struct mm_walk *walk); > int (*install_pte)(unsigned long addr, unsigned long next, > - pte_t *ptep, struct mm_walk *walk); > + pte_t *ptentp, struct mm_walk *walk); > enum page_walk_lock walk_lock; > }; > > diff --git a/mm/ksm.c b/mm/ksm.c > index 624f37975e129..2a4f19fe0f696 100644 > --- a/mm/ksm.c > +++ b/mm/ksm.c > @@ -1292,7 +1292,7 @@ static u32 calc_checksum(struct page *page) > } > > static int write_protect_page(struct vm_area_struct *vma, struct folio > *folio, > - pte_t *orig_pte) > + pte_t *ptentp) > { > struct mm_struct *mm = vma->vm_mm; > DEFINE_FOLIO_VMA_WALK(pvmw, folio, vma, 0, 0); > @@ -1371,7 +1371,7 @@ static int write_protect_page(struct vm_area_struct > *vma, struct folio *folio, > > set_pte_at(mm, pvmw.address, pvmw.pte, entry); > } > - *orig_pte = entry; > + *ptentp = entry; > err = 0; > > out_unlock: > diff --git a/mm/madvise.c b/mm/madvise.c > index 73c2901b9adbf..dd75a673e108f 100644 > --- a/mm/madvise.c > +++ b/mm/madvise.c > @@ -1113,12 +1113,12 @@ static int guard_install_pte_entry(pte_t *pte, > unsigned long addr, > } > > static int guard_install_set_pte(unsigned long addr, unsigned long next, > - pte_t *ptep, struct mm_walk *walk) > + pte_t *ptentp, struct mm_walk *walk) > { > unsigned long *nr_pages = (unsigned long *)walk->private; > > /* Simply install a PTE marker, this causes segfault on access. */ > - *ptep = make_pte_marker(PTE_MARKER_GUARD); > + *ptentp = make_pte_marker(PTE_MARKER_GUARD); > (*nr_pages)++; > > return 0; > > -- > 2.47.3 >
