• Hugh Dickins's avatar
    [PATCH] mm: flush TLB when clearing young · 68dc3ce3
    Hugh Dickins authored
    Traditionally we've not flushed TLB after clearing the young/referenced bit,
    it has seemed just a waste of time.  Russell King points out that on some
    architectures, with the move from 2.4 mm sweeping to 2.6 rmap, this may be a
    serious omission: very frequently referenced pages never re-marked young, and
    the worst choices made for unmapping.
    
    So, replace ptep_test_and_clear_young by ptep_clear_flush_young throughout
    rmap.c.  Originally I'd imagined making some kind of TLB gather optimization,
    but don't see what now: whether worth it rather depends on how common
    cross-cpu flushes are, and whether global or not.
    
    ppc and ppc64 have already found this issue, and worked around it by arranging
    TLB flush from their ptep_test_and_clear_young: with the aid of pgtable rmap
    pointers.  I'm hoping ptep_clear_flush_young will allow ppc and ppc64 to
    remove that special code, but won't change them myself.
    
    It's worth noting that it is Andrea's anon_vma rmap which makes the vma
    available for ptep_clear_flush_young in page_referenced_one: anonmm and
    pte_chains would both need an additional find_vma for that.
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    68dc3ce3
rmap.c 20.1 KB