• Kirill A. Shutemov's avatar
    thp: rewrite freeze_page()/unfreeze_page() with generic rmap walkers · fec89c10
    Kirill A. Shutemov authored
    freeze_page() and unfreeze_page() helpers evolved in rather complex
    beasts.  It would be nice to cut complexity of this code.
    
    This patch rewrites freeze_page() using standard try_to_unmap().
    unfreeze_page() is rewritten with remove_migration_ptes().
    
    The result is much simpler.
    
    But the new variant is somewhat slower for PTE-mapped THPs.  Current
    helpers iterates over VMAs the compound page is mapped to, and then over
    ptes within this VMA.  New helpers iterates over small page, then over
    VMA the small page mapped to, and only then find relevant pte.
    
    We have short cut for PMD-mapped THP: we directly install migration
    entries on PMD split.
    
    I don't think the slowdown is critical, considering how much simpler
    result is and that split_huge_page() is quite rare nowadays.  It only
    happens due memory pressure or migration.
    Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    fec89c10
huge_memory.c 90.4 KB