# Re: \[PATCH v5 11/25\] mm: Introduce arch\_calc\_vm\_flag\_bits()

- From: Catalin Marinas \<catalin.marinas@arm.com\>
- Date: 2020-06-25 17:34:11 
- List: linux-arm-kernel
- Page: https://ratatoskr.run/linux-arm-kernel/2020/06/6501597
- Thread: https://ratatoskr.run/linux-arm-kernel/2020/06/6501533/t.md

```text
On Wed, Jun 24, 2020 at 11:36:11AM -0700, Andrew Morton wrote:
> On Wed, 24 Jun 2020 18:52:30 +0100 Catalin Marinas [ref] wrote:
> > From: Kevin Brodsky <redacted>
> > Similarly to arch_calc_vm_prot_bits(), introduce a dummy
> > arch_calc_vm_flag_bits() invoked from calc_vm_flag_bits(). This macro
> > can be overridden by architectures to insert specific VM_* flags derived
> > from the mmap() MAP_* flags.
> > 
> > ...
> >
> > --- a/include/linux/mman.h
> > +++ b/include/linux/mman.h
> > @@ -74,13 +74,17 @@ static inline void vm_unacct_memory(long pages)
> >  }
> >  
> >  /*
> > - * Allow architectures to handle additional protection bits
> > + * Allow architectures to handle additional protection and flag bits
> >   */
> >  
> >  #ifndef arch_calc_vm_prot_bits
> >  #define arch_calc_vm_prot_bits(prot, pkey) 0
> >  #endif
> >  
> > +#ifndef arch_calc_vm_flag_bits
> > +#define arch_calc_vm_flag_bits(flags) 0
> > +#endif
> 
> It would be helpful to add a comment specifying which arch header file
> is responsible for defining arch_calc_vm_flag_bits.  Because in the
> past we've messed this sort of thing up and had different architectures
> define things in different header files, resulting in build issues as
> code evolves.

I'll add a comment that the overriding definitions need to go in the
arch asm/mman.h file.

Thanks.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```
