• Nicholas Piggin's avatar
    powerpc/64s/radix: avoid ptesync after set_pte and ptep_set_access_flags · f1cb8f9b
    Nicholas Piggin authored
    The ISA suggests ptesync after setting a pte, to prevent a table walk
    initiated by a subsequent access from missing that store and causing a
    spurious fault. This is an architectual allowance that allows an
    implementation's page table walker to be incoherent with the store
    queue.
    
    However there is no correctness problem in taking a spurious fault in
    userspace -- the kernel copes with these at any time, so the updated
    pte will be found eventually. Spurious kernel faults on vmap memory
    must be avoided, so a ptesync is put into flush_cache_vmap.
    
    On POWER9 so far I have not found a measurable window where this can
    result in more minor faults, so as an optimisation, remove the costly
    ptesync from pte updates. If an implementation benefits from ptesync,
    it would be better to add it back in update_mmu_cache, so it's not
    done for things like fork(2).
    
    fork --fork --exec benchmark improved 5.2% (12400->13100).
    Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    f1cb8f9b
cacheflush.h 4.21 KB