linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] microblaze: switch to generic version of pte allocation
@ 2019-08-13 10:09 Mike Rapoport
  2019-08-13 10:20 ` Mark Rutland
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Rapoport @ 2019-08-13 10:09 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Michal Simek, Mark Rutland, linux-mm, linux-kernel, Mike Rapoport

The microblaze implementation of pte_alloc_one() has a provision to
allocated PTEs from high memory, but neither CONFIG_HIGHPTE nor pte_map*()
versions for suitable for HIGHPTE are defined.

Except that, microblaze version of pte_alloc_one() is identical to the
generic one as well as the implementations of pte_free() and
pte_free_kernel().

Switch microblaze to use the generic versions of these functions.
Also remove pte_free_slow() that is not referenced anywhere in the code.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
The patch is vs. mmots/master since this tree contains bothi "mm: remove
quicklist page table caches" and "mm: treewide: clarify
pgtable_page_{ctor,dtor}() naming" patches that had a conflict resulting in
a build failure [1].

[1] https://lore.kernel.org/linux-mm/201908131204.B910fkl1%25lkp@intel.com/

 arch/microblaze/include/asm/pgalloc.h | 39 +++--------------------------------
 1 file changed, 3 insertions(+), 36 deletions(-)

diff --git a/arch/microblaze/include/asm/pgalloc.h b/arch/microblaze/include/asm/pgalloc.h
index dbf25a3..7ecb05b 100644
--- a/arch/microblaze/include/asm/pgalloc.h
+++ b/arch/microblaze/include/asm/pgalloc.h
@@ -21,6 +21,9 @@
 #include <asm/cache.h>
 #include <asm/pgtable.h>
 
+#define __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL
+#include <asm-generic/pgalloc.h>
+
 extern void __bad_pte(pmd_t *pmd);
 
 static inline pgd_t *get_pgd(void)
@@ -47,42 +50,6 @@ static inline void free_pgd(pgd_t *pgd)
 
 extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm);
 
-static inline struct page *pte_alloc_one(struct mm_struct *mm)
-{
-	struct page *ptepage;
-
-#ifdef CONFIG_HIGHPTE
-	int flags = GFP_KERNEL | __GFP_ZERO | __GFP_HIGHMEM;
-#else
-	int flags = GFP_KERNEL | __GFP_ZERO;
-#endif
-
-	ptepage = alloc_pages(flags, 0);
-	if (!ptepage)
-		return NULL;
-	if (!pgtable_page_ctor(ptepage)) {
-		__free_page(ptepage);
-		return NULL;
-	}
-	return ptepage;
-}
-
-static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
-{
-	free_page((unsigned long)pte);
-}
-
-static inline void pte_free_slow(struct page *ptepage)
-{
-	__free_page(ptepage);
-}
-
-static inline void pte_free(struct mm_struct *mm, struct page *ptepage)
-{
-	pgtable_pte_page_dtor(ptepage);
-	__free_page(ptepage);
-}
-
 #define __pte_free_tlb(tlb, pte, addr)	pte_free((tlb)->mm, (pte))
 
 #define pmd_populate(mm, pmd, pte) \
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] microblaze: switch to generic version of pte allocation
  2019-08-13 10:09 [PATCH] microblaze: switch to generic version of pte allocation Mike Rapoport
@ 2019-08-13 10:20 ` Mark Rutland
  2019-08-13 12:52   ` Mike Rapoport
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Rutland @ 2019-08-13 10:20 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: Andrew Morton, Michal Simek, linux-mm, linux-kernel

On Tue, Aug 13, 2019 at 01:09:12PM +0300, Mike Rapoport wrote:
> The microblaze implementation of pte_alloc_one() has a provision to
> allocated PTEs from high memory, but neither CONFIG_HIGHPTE nor pte_map*()
> versions for suitable for HIGHPTE are defined.
> 
> Except that, microblaze version of pte_alloc_one() is identical to the
> generic one as well as the implementations of pte_free() and
> pte_free_kernel().
> 
> Switch microblaze to use the generic versions of these functions.
> Also remove pte_free_slow() that is not referenced anywhere in the code.
> 
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> The patch is vs. mmots/master since this tree contains bothi "mm: remove
> quicklist page table caches" and "mm: treewide: clarify
> pgtable_page_{ctor,dtor}() naming" patches that had a conflict resulting in
> a build failure [1].
> 
> [1] https://lore.kernel.org/linux-mm/201908131204.B910fkl1%25lkp@intel.com/

This looks sane to me, so FWIW:

Acked-by: Mark Rutland <mark.rutland@arm.com>

I guess Andrew will pick this up and fix up the conflict?

Thanks,
Mark.

> 
>  arch/microblaze/include/asm/pgalloc.h | 39 +++--------------------------------
>  1 file changed, 3 insertions(+), 36 deletions(-)
> 
> diff --git a/arch/microblaze/include/asm/pgalloc.h b/arch/microblaze/include/asm/pgalloc.h
> index dbf25a3..7ecb05b 100644
> --- a/arch/microblaze/include/asm/pgalloc.h
> +++ b/arch/microblaze/include/asm/pgalloc.h
> @@ -21,6 +21,9 @@
>  #include <asm/cache.h>
>  #include <asm/pgtable.h>
>  
> +#define __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL
> +#include <asm-generic/pgalloc.h>
> +
>  extern void __bad_pte(pmd_t *pmd);
>  
>  static inline pgd_t *get_pgd(void)
> @@ -47,42 +50,6 @@ static inline void free_pgd(pgd_t *pgd)
>  
>  extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm);
>  
> -static inline struct page *pte_alloc_one(struct mm_struct *mm)
> -{
> -	struct page *ptepage;
> -
> -#ifdef CONFIG_HIGHPTE
> -	int flags = GFP_KERNEL | __GFP_ZERO | __GFP_HIGHMEM;
> -#else
> -	int flags = GFP_KERNEL | __GFP_ZERO;
> -#endif
> -
> -	ptepage = alloc_pages(flags, 0);
> -	if (!ptepage)
> -		return NULL;
> -	if (!pgtable_page_ctor(ptepage)) {
> -		__free_page(ptepage);
> -		return NULL;
> -	}
> -	return ptepage;
> -}
> -
> -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
> -{
> -	free_page((unsigned long)pte);
> -}
> -
> -static inline void pte_free_slow(struct page *ptepage)
> -{
> -	__free_page(ptepage);
> -}
> -
> -static inline void pte_free(struct mm_struct *mm, struct page *ptepage)
> -{
> -	pgtable_pte_page_dtor(ptepage);
> -	__free_page(ptepage);
> -}
> -
>  #define __pte_free_tlb(tlb, pte, addr)	pte_free((tlb)->mm, (pte))
>  
>  #define pmd_populate(mm, pmd, pte) \
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] microblaze: switch to generic version of pte allocation
  2019-08-13 10:20 ` Mark Rutland
@ 2019-08-13 12:52   ` Mike Rapoport
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Rapoport @ 2019-08-13 12:52 UTC (permalink / raw)
  To: Mark Rutland; +Cc: Andrew Morton, Michal Simek, linux-mm, linux-kernel

On Tue, Aug 13, 2019 at 11:20:50AM +0100, Mark Rutland wrote:
> On Tue, Aug 13, 2019 at 01:09:12PM +0300, Mike Rapoport wrote:
> > The microblaze implementation of pte_alloc_one() has a provision to
> > allocated PTEs from high memory, but neither CONFIG_HIGHPTE nor pte_map*()
> > versions for suitable for HIGHPTE are defined.
> > 
> > Except that, microblaze version of pte_alloc_one() is identical to the
> > generic one as well as the implementations of pte_free() and
> > pte_free_kernel().
> > 
> > Switch microblaze to use the generic versions of these functions.
> > Also remove pte_free_slow() that is not referenced anywhere in the code.
> > 
> > Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> > ---
> > The patch is vs. mmots/master since this tree contains bothi "mm: remove
> > quicklist page table caches" and "mm: treewide: clarify
> > pgtable_page_{ctor,dtor}() naming" patches that had a conflict resulting in
> > a build failure [1].
> > 
> > [1] https://lore.kernel.org/linux-mm/201908131204.B910fkl1%25lkp@intel.com/
> 
> This looks sane to me, so FWIW:
> 
> Acked-by: Mark Rutland <mark.rutland@arm.com>

Thanks!
 
> I guess Andrew will pick this up and fix up the conflict?

I hope so :)

> Thanks,
> Mark.
> 
> > 
> >  arch/microblaze/include/asm/pgalloc.h | 39 +++--------------------------------
> >  1 file changed, 3 insertions(+), 36 deletions(-)
> > 
> > diff --git a/arch/microblaze/include/asm/pgalloc.h b/arch/microblaze/include/asm/pgalloc.h
> > index dbf25a3..7ecb05b 100644
> > --- a/arch/microblaze/include/asm/pgalloc.h
> > +++ b/arch/microblaze/include/asm/pgalloc.h
> > @@ -21,6 +21,9 @@
> >  #include <asm/cache.h>
> >  #include <asm/pgtable.h>
> >  
> > +#define __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL
> > +#include <asm-generic/pgalloc.h>
> > +
> >  extern void __bad_pte(pmd_t *pmd);
> >  
> >  static inline pgd_t *get_pgd(void)
> > @@ -47,42 +50,6 @@ static inline void free_pgd(pgd_t *pgd)
> >  
> >  extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm);
> >  
> > -static inline struct page *pte_alloc_one(struct mm_struct *mm)
> > -{
> > -	struct page *ptepage;
> > -
> > -#ifdef CONFIG_HIGHPTE
> > -	int flags = GFP_KERNEL | __GFP_ZERO | __GFP_HIGHMEM;
> > -#else
> > -	int flags = GFP_KERNEL | __GFP_ZERO;
> > -#endif
> > -
> > -	ptepage = alloc_pages(flags, 0);
> > -	if (!ptepage)
> > -		return NULL;
> > -	if (!pgtable_page_ctor(ptepage)) {
> > -		__free_page(ptepage);
> > -		return NULL;
> > -	}
> > -	return ptepage;
> > -}
> > -
> > -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
> > -{
> > -	free_page((unsigned long)pte);
> > -}
> > -
> > -static inline void pte_free_slow(struct page *ptepage)
> > -{
> > -	__free_page(ptepage);
> > -}
> > -
> > -static inline void pte_free(struct mm_struct *mm, struct page *ptepage)
> > -{
> > -	pgtable_pte_page_dtor(ptepage);
> > -	__free_page(ptepage);
> > -}
> > -
> >  #define __pte_free_tlb(tlb, pte, addr)	pte_free((tlb)->mm, (pte))
> >  
> >  #define pmd_populate(mm, pmd, pte) \
> > -- 
> > 2.7.4
> > 

-- 
Sincerely yours,
Mike.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-13 12:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-13 10:09 [PATCH] microblaze: switch to generic version of pte allocation Mike Rapoport
2019-08-13 10:20 ` Mark Rutland
2019-08-13 12:52   ` Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).