[PATCH 12/15] powerpc/nohash/64: switch to generic version of pte allocation

Christophe Leroy christophe.leroy at c-s.fr
Fri May 3 02:56:07 AEST 2019



Le 02/05/2019 à 17:28, Mike Rapoport a écrit :
> The 64-bit book-E powerpc implements pte_alloc_one(),
> pte_alloc_one_kernel(), pte_free_kernel() and pte_free() the same way as
> the generic version.

Will soon be converted to the same as the 3 other PPC subarches, see
https://patchwork.ozlabs.org/patch/1091590/

Christophe

> 
> Switch it to the generic version that does exactly the same thing.
> 
> Signed-off-by: Mike Rapoport <rppt at linux.ibm.com>
> ---
>   arch/powerpc/include/asm/nohash/64/pgalloc.h | 35 ++--------------------------
>   1 file changed, 2 insertions(+), 33 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/nohash/64/pgalloc.h b/arch/powerpc/include/asm/nohash/64/pgalloc.h
> index 66d086f..bfb53a0 100644
> --- a/arch/powerpc/include/asm/nohash/64/pgalloc.h
> +++ b/arch/powerpc/include/asm/nohash/64/pgalloc.h
> @@ -11,6 +11,8 @@
>   #include <linux/cpumask.h>
>   #include <linux/percpu.h>
>   
> +#include <asm-generic/pgalloc.h>	/* for pte_{alloc,free}_one */
> +
>   struct vmemmap_backing {
>   	struct vmemmap_backing *list;
>   	unsigned long phys;
> @@ -92,39 +94,6 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
>   	kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd);
>   }
>   
> -
> -static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
> -{
> -	return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
> -}
> -
> -static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
> -{
> -	struct page *page;
> -	pte_t *pte;
> -
> -	pte = (pte_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO | __GFP_ACCOUNT);
> -	if (!pte)
> -		return NULL;
> -	page = virt_to_page(pte);
> -	if (!pgtable_page_ctor(page)) {
> -		__free_page(page);
> -		return NULL;
> -	}
> -	return page;
> -}
> -
> -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
> -{
> -	free_page((unsigned long)pte);
> -}
> -
> -static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
> -{
> -	pgtable_page_dtor(ptepage);
> -	__free_page(ptepage);
> -}
> -
>   static inline void pgtable_free(void *table, int shift)
>   {
>   	if (!shift) {
> 


More information about the Linuxppc-dev mailing list