Re: [PATCH] mm: gup: fix the fast GUP race against THP collapse

From: Aneesh Kumar K.V
Date: Mon Sep 05 2022 - 04:56:32 EST


Peter Xu <peterx@xxxxxxxxxx> writes:

>
> On Fri, Sep 02, 2022 at 10:45:20AM -0700, Yang Shi wrote:
>> > How about another patch to remove the ppc impl too? Then it can be a two
>> > patches series.
>>
>> BTW, I don't think we could remove the ppc implementation since it is
>> different from the generic pmdp_collapse_flush(), particularly for the
>> hash part IIUC.
>>
>> The generic version calls flush_tlb_range() -> hash__flush_tlb_range()
>> for hash, but the hash call is actually no-op. The ppc version calls
>> hash__pmdp_collapse_flush() -> flush_tlb_pmd_range(), which does
>> something useful.
>
> One thing I found interesting (and also a bit confused..) is that the ppc
> code used the name flush_tlb_pmd_range() to "flush tlb range in pte level",
> which is kind of against the tlb API design..
>
> The generic tlb API has a very close function called flush_pmd_tlb_range()
> which is only used to do pmd-level flushing, while here the ppc version of
> flush_tlb_pmd_range() is actually flush_tlb_range() in the generic API.
>
> Agreed that it may worth having a look from ppc developers.
>

It is actually flushing the hash page table entries. I will rename
flush_tlb_pmd_range to flush_hash_table_pmd_range().

-aneesh