Subject: Re: [PATCH 10/10] powerpc/mm/slice: remove radix calls to the slice code

From: Nicholas Piggin <[email-masked]>
Date: Wed, 7 Mar 2018 09:35:53 +1000

On Tue, 6 Mar 2018 16:12:34 +0100
Christophe LEROY <[email-masked]> wrote:

> Le 06/03/2018 à 14:25, Nicholas Piggin a écrit :
> > This is a tidy up which removes radix MMU calls into the slice
> > code.
> > 
> > Signed-off-by: Nicholas Piggin <[email-masked]>
> > ---
> >   arch/powerpc/include/asm/hugetlb.h |  9 ++++++---
> >   arch/powerpc/mm/hugetlbpage.c      |  5 +++--
> >   arch/powerpc/mm/slice.c            | 17 ++++-------------
> >   3 files changed, 13 insertions(+), 18 deletions(-)
> > 
> > diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
> > index 1a4847f67ea8..59885d444695 100644
> > --- a/arch/powerpc/include/asm/hugetlb.h
> > +++ b/arch/powerpc/include/asm/hugetlb.h
> > @@ -90,16 +90,19 @@ pte_t *huge_pte_offset_and_shift(struct mm_struct *mm,
> >   void flush_dcache_icache_hugepage(struct page *page);
> >   
> >   #if defined(CONFIG_PPC_MM_SLICES)
> > -int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
> > +int slice_is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
> >   			   unsigned long len);
> > -#else
> > +#endif
> >   static inline int is_hugepage_only_range(struct mm_struct *mm,
> >   					 unsigned long addr,
> >   					 unsigned long len)
> >   {
> > +#if defined(CONFIG_PPC_MM_SLICES)
> > +	if (!radix_enabled())
> > +		return slice_is_hugepage_only_range(mm, addr, len);
> > +#endif
> >   	return 0;  
> 
> Might be easier to understand as
> 
> 	if (!IS_ENABLED(CONFIG_PPC_MM_SLICES) || radix_enabled())
> 		return 0;
> 	return slice_is_hugepage_only_range(mm, addr, len);

Yep.

> >   unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
> >   {
> >   #ifdef CONFIG_PPC_MM_SLICES
> > -	unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start);
> >   	/* With radix we don't use slice, so derive it from vma*/
> > -	if (!radix_enabled())
> > +	if (!radix_enabled()) {
> > +		unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start);  
> 
> Insert a blank line here.

Okay.

Thanks for the review, it's really appreciated.

Thanks,
Nick