• Hugh Dickins's avatar
    ksm: stable_node point to page and back · 08beca44
    Hugh Dickins authored
    Add a pointer to the ksm page into struct stable_node, holding a reference
    to the page while the node exists.  Put a pointer to the stable_node into
    the ksm page's ->mapping.
    
    Then we don't need get_ksm_page() while traversing the stable tree: the
    page to compare against is sure to be present and correct, even if it's no
    longer visible through any of its existing rmap_items.
    
    And we can handle the forked ksm page case more efficiently: no need to
    memcmp our way through the tree to find its match.
    Signed-off-by: default avatarHugh Dickins <hugh.dickins@tiscali.co.uk>
    Cc: Izik Eidus <ieidus@redhat.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>
    08beca44
ksm.c 43.7 KB