Re: [PATCH v2 3/6] mm/powerpc/8xx: constify ptep_get() argument

"Lorenzo Stoakes (ARM)" <[email protected]> Tue, 4 Aug 2026 13:43:45 +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 <anHeZx6Gg7waNWjL@lucifer>
On Tue, Aug 04, 2026 at 01:38:52PM +0100, Pedro Falcato wrote:
> On Tue, Aug 04, 2026 at 12:13:13PM +0100, Lorenzo Stoakes (ARM) wrote:
> > On Mon, Aug 03, 2026 at 05:43:57PM +0100, Pedro Falcato wrote:
> > > There is no need for write access to the PTE.
> > >
> > > Signed-off-by: Pedro Falcato <[email protected]>
> >
> > With below addressed LGTM so:
> >
> > Reviewed-by: Lorenzo Stoakes (ARM) <[email protected]>
> >
> > > ---
> > >  arch/powerpc/include/asm/nohash/32/pte-8xx.h | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/arch/powerpc/include/asm/nohash/32/pte-8xx.h b/arch/powerpc/include/asm/nohash/32/pte-8xx.h
> > > index e2ea8ba9f8ca..f2bab31040c7 100644
> > > --- a/arch/powerpc/include/asm/nohash/32/pte-8xx.h
> > > +++ b/arch/powerpc/include/asm/nohash/32/pte-8xx.h
> > > @@ -226,7 +226,7 @@ static inline pte_basic_t pte_update(struct mm_struct *mm, unsigned long addr, p
> > >
> > >  #ifdef CONFIG_PPC_16K_PAGES
> > >  #define ptep_get ptep_get
> > > -static inline pte_t ptep_get(pte_t *ptep)
> > > +static inline pte_t ptep_get(const pte_t *ptep)
> > >  {
> > >  	pte_basic_t val = READ_ONCE(ptep->pte);
> > >  	pte_t pte = {val, val, val, val};
> >
> > Worth making these const too (that {val, val, val, val} horrifies me btw :)?
>
> This is PPC code, so I don't know if they have any particular opinion here,
> but I could definitely do this.
>
> (FWIW, it seems we're more aggressive in MM in doing this than other places
> in the kernel?)

I mean I can't see why there'd be any objection given you're already const-ing
here :)

>
> --
> Pedro

--
Cheers, Lorenzo