Subject: Re: [PATCH 3/3] powerpc/mm/radix: Flush page walk cache when freeing page table

From: Benjamin Herrenschmidt <[email-masked]>
Date: Fri, 03 Jun 2016 11:03:38 +1000

On Thu, 2016-06-02 at 15:16 +0530, Aneesh Kumar K.V wrote:
> 
> 
> +/*
> + * flush the page walk cache for the address
> + */
> +void flush_tlb_pgtable(struct mmu_gather *tlb, unsigned long address)
> +{
> +       struct mm_struct *mm = tlb->mm;
> +       /*
> +        * flush the page table walk cache on freeing page table. We already
> +        * have marked the upper/higher level page table entry none by now.
> +        * So it is safe to flush PWC here.
> +        */
> +       if (!radix_enabled())
> +               return;
> +       radix__flush_tlb_mm_pwc(mm);

That means that on hash, we pay the price of a useless function call
and return. Shouldn't we put the radix_enabled() test in the caller
instead ?

Cheers,
Ben.