Re: [PATCH 1/3] mm: change vm_get_page_prot() to accept vm_flags_t argument

Lorenzo Stoakes
2025-06-19T12:19:18Z

On Thu, Jun 19, 2025 at 01:31:50PM +0200, Vlastimil Babka wrote:
> On 6/18/25 21:42, Lorenzo Stoakes wrote:
> > We abstract the type of the VMA flags to vm_flags_t, however in may places
> > it is simply assumed this is unsigned long, which is simply incorrect.
> >
> > At the moment this is simply an incongruity, however in future we plan to
> > change this type and therefore this change is a critical requirement for
> > doing so.
> >
> > Overall, this patch does not introduce any functional change.
> >
> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
>
> > diff --git a/arch/powerpc/include/asm/book3s/64/pkeys.h b/arch/powerpc/include/asm/book3s/64/pkeys.h
> > index 5b178139f3c0..6f2075636591 100644
> > --- a/arch/powerpc/include/asm/book3s/64/pkeys.h
> > +++ b/arch/powerpc/include/asm/book3s/64/pkeys.h
> > @@ -4,8 +4,9 @@
> > #define _ASM_POWERPC_BOOK3S_64_PKEYS_H
> >
> > #include <asm/book3s/64/hash-pkey.h>
> > +#include <linux/mm_types.h>
>
> Hopefully not causing a circular header include.

Well bots should say if so :) these headers would surely be broken if that were
the case.

However, since the only caller is arch/powerpc/mm/book3s64/pgtable.c and that
already imports mm_types.h I will drop this to be safe.

>
> > -static inline u64 vmflag_to_pte_pkey_bits(u64 vm_flags)
> > +static inline u64 vmflag_to_pte_pkey_bits(vm_flags_t vm_flags)
>
> Is this change rather for patch 3? It's not changing vm_get_page_prot().
> OTOH git grep shows me you missed:

No it's necessary as it's called by vm_get_page_prot().

>
> arch/powerpc/mm/book3s64/pgtable.c:pgprot_t vm_get_page_prot(unsigned long
> vm_flags)

Ugh I checked and double checked this and yet somehow... :)

Let me send a fix-patch for removing the include and converting this.

>
> With that sorted out, feel free to add:
>
> Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
>
> Thanks!

Thanks!