Re: [PATCH v3 3/5] fs/proc/task_mmu: read the PMD once in smaps_pmd_entry()

From: Usama Arif

Date: Wed Nov 25 2026 - 06:52:31 EST


On Tue, 24 Nov 2026 09:25:14 +0100 "David Hildenbrand (Arm)" <david@xxxxxxxxxx> wrote:

> On 11/23/26 18:55, Usama Arif wrote:
> >
> >
> > On 23/11/2026 09:24, Lorenzo Stoakes (ARM) wrote:
> >> On Mon, Nov 23, 2026 at 08:32:09AM -0800, Usama Arif wrote:
> >>> smaps_pmd_entry() dereferences the pmd pointer six times. Read it once
> >>> into a local with pmdp_get(), the way smaps_pte_entry() already does
> >>> with ptep_get(), so that every test sees the same value.
> >>>
> >>> No functional change intended.
> >>>
> >>> Suggested-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
> >>> Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>
> >>
> >> LGTM so:
> >>
> >> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
> >
> >
> > Thanks for the reviews!!
> >
> >>
> >>> ---
> >>> fs/proc/task_mmu.c | 11 ++++++-----
> >>> 1 file changed, 6 insertions(+), 5 deletions(-)
> >>>
> >>> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> >>> index 540c936aad4714..105c4998eef48f 100644
> >>> --- a/fs/proc/task_mmu.c
> >>> +++ b/fs/proc/task_mmu.c
> >>> @@ -1022,14 +1022,15 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
> >>> struct page *page = NULL;
> >>> bool present = false;
> >>> struct folio *folio;
> >>> + pmd_t pmdval = pmdp_get(pmd);
> >>
> >> NIT: Can this be const or are the helpers not safe for it?
> >
> > Ah yes, good point. Its good to have const here.
> >
> > I think the rest of the series is good to merge. Should I wait
> > a few days and send a new revision with the const change here?
>
> I'd pick the fist two directly. Can you resend the other 3 such that Andrew can
> pick them?

Will do! Thanks for picking them up!

>
> --
> Cheers,
>
> David
>