• Mark Rutland's avatar
    arm64: mm: avoid redundant READ_ONCE(*ptep) · 9b604722
    Mark Rutland authored
    In set_pte_at(), we read the old pte value so that it can be passed into
    checks for racy hw updates. These checks are only performed for
    CONFIG_DEBUG_VM, and the value is not used otherwise.
    
    Since we read the pte value with READ_ONCE(), the compiler cannot elide
    the redundant read for !CONFIG_DEBUG_VM kernels.
    
    Let's ameliorate matters by moving the read and the checks into a
    helper, __check_racy_pte_update(), which only performs the read when the
    value will be used. This also allows us to reformat the conditions for
    clarity.
    Acked-by: default avatarWill Deacon <will.deacon@arm.com>
    Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
    Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    9b604722
pgtable.h 24.9 KB