powerpc/64s: add pte_needs_flush and huge_pmd_needs_flush
authorNicholas Piggin <npiggin@gmail.com>
Thu, 1 Sep 2022 11:03:34 +0000 (21:03 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 8 Sep 2022 01:11:18 +0000 (11:11 +1000)
commitb11931e9adc1a439eab75c97ca4b9f15754cdcb1
tree0aac8dccb9c47241a147f2fc9e6183b90366d676
parent78c73c80fd860d5b3471d8eaa2778a105a56f6ab
powerpc/64s: add pte_needs_flush and huge_pmd_needs_flush

Allow PTE changes to avoid flushing the TLB when access permissions are
being relaxed, the dirty bit is being set, and the accessed bit is being
changed.

Relaxing access permissions and setting dirty and accessed bits do not
require a flush because the MMU will re-load the PTE and notice the
updates (it may also cause a spurious fault).

Clearing the accessed bit does not require a flush because of the
imprecise PTE accessed bit accounting that is already performed, as
documented in ptep_clear_flush_young().

This reduces TLB flushing for some mprotect(2) calls.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/20220901110334.1618913-1-npiggin@gmail.com
arch/powerpc/include/asm/book3s/64/pgtable.h
arch/powerpc/include/asm/book3s/64/tlbflush.h