• Hugh Dickins's avatar
    tmpfs: convert shmem_truncate_range to radix-swap · 7a5d0fbb
    Hugh Dickins authored
    Disable the toy swapping implementation in shmem_writepage() - it's hard
    to support two schemes at once - and convert shmem_truncate_range() to a
    lockless gang lookup of swap entries along with pages, freeing both.
    
    Since the second loop tightens its noose until all entries of either
    kind have been squeezed out (and we shall make sure that there's not an
    instant when neither is visible), there is no longer a need for yet
    another pass below.
    
    shmem_radix_tree_replace() compensates for the lockless lookup by
    checking that the expected entry is in place, under lock, before
    replacing it.  Here it just deletes, but will be used in later patches
    to substitute swap entry for page or page for swap entry.
    Signed-off-by: default avatarHugh Dickins <hughd@google.com>
    Acked-by: default avatarRik van Riel <riel@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    7a5d0fbb
shmem.c 65.5 KB