• Hugh Dickins's avatar
    [PATCH] swap 2/3 unsafe SwapCache check · f53bfec8
    Hugh Dickins authored
    Recent testing has shown that BUG() check in try_to_unuse is unsafe.
    delete_from_swap_cache does final swap_free just after removing page
    from swap cache, and add_to_swap_cache does swap_duplicate just before
    putting page into swap cache, therefore swapin_readahead may resurrect
    a dying swap entry and assign a new page to it.  That's fine, there's
    no need to change this ordering; but it does mean that try_to_unuse's
    page may have left the swap cache yet its swap_map count still be set.
    That BUG() has done good service for swapoff sanity, but now abandon it.
    f53bfec8
swapfile.c 31.4 KB