Re: [PATCH v1] mm/gup: adjust stale comment for RCU GUP-fast

From: Peter Xu
Date: Fri Sep 02 2022 - 10:26:50 EST


On Fri, Sep 02, 2022 at 08:32:42AM +0200, David Hildenbrand wrote:
> Note that this matches ptep_get_and_clear() behavior on s390x. Quoting the comment in there:
>
>
> /*
> * This is hard to understand. ptep_get_and_clear and ptep_clear_flush
> * both clear the TLB for the unmapped pte. The reason is that
> * ptep_get_and_clear is used in common code (e.g. change_pte_range)
> * to modify an active pte. The sequence is
> * 1) ptep_get_and_clear
> * 2) set_pte_at
> * 3) flush_tlb_range
> * On s390 the tlb needs to get flushed with the modification of the pte
> * if the pte is active. The only way how this can be implemented is to
> * have ptep_get_and_clear do the tlb flush. In exchange flush_tlb_range
> * is a nop.
> */

Ah, now I kind of see why s390 has its own world of pte operations.

But then we really should be noted on reworking the generic tlb code
because s390 is always special; people will think the generic tlb API is
for tlb but no-op for s390, e.g. anyone optimizes generic tlb flushing
it'll probably never apply to s390.

Besides performance, hopefully there'll be no case where the tlb change
will be functional then it may affect s390 too. But I don't see any since
as long as tlb was flushed earlier than the API then it seems always safe.
Just trickier.

--
Peter Xu