Re: [PATCH V4 02/26] mm/mmap: Define DECLARE_VM_GET_PAGE_PROT
Le 24/06/2022 à 06:43, Anshuman Khandual a écrit : > This just converts the generic vm_get_page_prot() implementation into a new > macro i.e DECLARE_VM_GET_PAGE_PROT which later can be used across platforms > when enabling them with ARCH_HAS_VM_GET_PAGE_PROT. This does not create any > functional change. > > Cc: Andrew Morton > Cc: linux...@kvack.org > Cc: linux-ker...@vger.kernel.org > Suggested-by: Christoph Hellwig > Signed-off-by: Anshuman Khandual Reviewed-by: Christophe Leroy > --- > include/linux/mm.h | 8 > mm/mmap.c | 6 +- > 2 files changed, 9 insertions(+), 5 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 47bfe038d46e..237828c2bae2 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -428,6 +428,14 @@ extern unsigned int kobjsize(const void *objp); > extern pgprot_t protection_map[16]; > #endif > > +#define DECLARE_VM_GET_PAGE_PROT \ > +pgprot_t vm_get_page_prot(unsigned long vm_flags)\ > +{\ > + return protection_map[vm_flags &\ > + (VM_READ | VM_WRITE | VM_EXEC | VM_SHARED)];\ > +}\ > +EXPORT_SYMBOL(vm_get_page_prot); > + > /* >* The default fault flags that should be used by most of the >* arch-specific page fault handlers. > diff --git a/mm/mmap.c b/mm/mmap.c > index b01f0280bda2..55c30aee3999 100644 > --- a/mm/mmap.c > +++ b/mm/mmap.c > @@ -123,11 +123,7 @@ pgprot_t protection_map[16] __ro_after_init = { > #endif > > #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT > -pgprot_t vm_get_page_prot(unsigned long vm_flags) > -{ > - return protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]; > -} > -EXPORT_SYMBOL(vm_get_page_prot); > +DECLARE_VM_GET_PAGE_PROT > #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */ > > static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags) ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V4 02/26] mm/mmap: Define DECLARE_VM_GET_PAGE_PROT
On 6/24/22 10:58, Christophe Leroy wrote: > > Le 24/06/2022 à 06:43, Anshuman Khandual a écrit : >> This just converts the generic vm_get_page_prot() implementation into a new >> macro i.e DECLARE_VM_GET_PAGE_PROT which later can be used across platforms >> when enabling them with ARCH_HAS_VM_GET_PAGE_PROT. This does not create any >> functional change. >> >> Cc: Andrew Morton >> Cc: linux...@kvack.org >> Cc: linux-ker...@vger.kernel.org >> Suggested-by: Christoph Hellwig >> Signed-off-by: Anshuman Khandual >> --- >> include/linux/mm.h | 8 >> mm/mmap.c | 6 +- >> 2 files changed, 9 insertions(+), 5 deletions(-) >> >> diff --git a/include/linux/mm.h b/include/linux/mm.h >> index 47bfe038d46e..237828c2bae2 100644 >> --- a/include/linux/mm.h >> +++ b/include/linux/mm.h >> @@ -428,6 +428,14 @@ extern unsigned int kobjsize(const void *objp); >> extern pgprot_t protection_map[16]; >> #endif >> > I think the comment above protection_map[16] in mm/mmap.c should be > moved here. Sure, makes sense. Will move. ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V4 02/26] mm/mmap: Define DECLARE_VM_GET_PAGE_PROT
On 6/24/22 10:39, Christoph Hellwig wrote: > On Fri, Jun 24, 2022 at 10:13:15AM +0530, Anshuman Khandual wrote: >> This just converts the generic vm_get_page_prot() implementation into a new >> macro i.e DECLARE_VM_GET_PAGE_PROT which later can be used across platforms >> when enabling them with ARCH_HAS_VM_GET_PAGE_PROT. This does not create any >> functional change. > > mm.h is a huhe header included by almost everything in the kernel. > I'd rather have it in something only included in a few files. If we > can't find anything suitable it might be worth to add a header just > for this even. I guess should be better ? ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V4 02/26] mm/mmap: Define DECLARE_VM_GET_PAGE_PROT
Le 24/06/2022 à 06:43, Anshuman Khandual a écrit : > This just converts the generic vm_get_page_prot() implementation into a new > macro i.e DECLARE_VM_GET_PAGE_PROT which later can be used across platforms > when enabling them with ARCH_HAS_VM_GET_PAGE_PROT. This does not create any > functional change. > > Cc: Andrew Morton > Cc: linux...@kvack.org > Cc: linux-ker...@vger.kernel.org > Suggested-by: Christoph Hellwig > Signed-off-by: Anshuman Khandual > --- > include/linux/mm.h | 8 > mm/mmap.c | 6 +- > 2 files changed, 9 insertions(+), 5 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 47bfe038d46e..237828c2bae2 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -428,6 +428,14 @@ extern unsigned int kobjsize(const void *objp); > extern pgprot_t protection_map[16]; > #endif > I think the comment above protection_map[16] in mm/mmap.c should be moved here. > +#define DECLARE_VM_GET_PAGE_PROT \ > +pgprot_t vm_get_page_prot(unsigned long vm_flags)\ > +{\ > + return protection_map[vm_flags &\ > + (VM_READ | VM_WRITE | VM_EXEC | VM_SHARED)];\ > +}\ > +EXPORT_SYMBOL(vm_get_page_prot); > + > /* >* The default fault flags that should be used by most of the >* arch-specific page fault handlers. > diff --git a/mm/mmap.c b/mm/mmap.c > index b01f0280bda2..55c30aee3999 100644 > --- a/mm/mmap.c > +++ b/mm/mmap.c > @@ -123,11 +123,7 @@ pgprot_t protection_map[16] __ro_after_init = { > #endif > > #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT > -pgprot_t vm_get_page_prot(unsigned long vm_flags) > -{ > - return protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]; > -} > -EXPORT_SYMBOL(vm_get_page_prot); > +DECLARE_VM_GET_PAGE_PROT > #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */ > > static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags) ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH V4 02/26] mm/mmap: Define DECLARE_VM_GET_PAGE_PROT
On Fri, Jun 24, 2022 at 10:13:15AM +0530, Anshuman Khandual wrote: > This just converts the generic vm_get_page_prot() implementation into a new > macro i.e DECLARE_VM_GET_PAGE_PROT which later can be used across platforms > when enabling them with ARCH_HAS_VM_GET_PAGE_PROT. This does not create any > functional change. mm.h is a huhe header included by almost everything in the kernel. I'd rather have it in something only included in a few files. If we can't find anything suitable it might be worth to add a header just for this even. ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH V4 02/26] mm/mmap: Define DECLARE_VM_GET_PAGE_PROT
This just converts the generic vm_get_page_prot() implementation into a new macro i.e DECLARE_VM_GET_PAGE_PROT which later can be used across platforms when enabling them with ARCH_HAS_VM_GET_PAGE_PROT. This does not create any functional change. Cc: Andrew Morton Cc: linux...@kvack.org Cc: linux-ker...@vger.kernel.org Suggested-by: Christoph Hellwig Signed-off-by: Anshuman Khandual --- include/linux/mm.h | 8 mm/mmap.c | 6 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 47bfe038d46e..237828c2bae2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -428,6 +428,14 @@ extern unsigned int kobjsize(const void *objp); extern pgprot_t protection_map[16]; #endif +#define DECLARE_VM_GET_PAGE_PROT \ +pgprot_t vm_get_page_prot(unsigned long vm_flags) \ +{ \ + return protection_map[vm_flags &\ + (VM_READ | VM_WRITE | VM_EXEC | VM_SHARED)];\ +} \ +EXPORT_SYMBOL(vm_get_page_prot); + /* * The default fault flags that should be used by most of the * arch-specific page fault handlers. diff --git a/mm/mmap.c b/mm/mmap.c index b01f0280bda2..55c30aee3999 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -123,11 +123,7 @@ pgprot_t protection_map[16] __ro_after_init = { #endif #ifndef CONFIG_ARCH_HAS_VM_GET_PAGE_PROT -pgprot_t vm_get_page_prot(unsigned long vm_flags) -{ - return protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]; -} -EXPORT_SYMBOL(vm_get_page_prot); +DECLARE_VM_GET_PAGE_PROT #endif /* CONFIG_ARCH_HAS_VM_GET_PAGE_PROT */ static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags) -- 2.25.1 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc