• Hugh Dickins's avatar
    swapfile: swap allocation use discard · 7992fde7
    Hugh Dickins authored
    When scan_swap_map() finds a free cluster of swap pages to allocate,
    discard the old contents of the cluster if the device supports discard.
    But don't bother when swap is so fragmented that we allocate single pages.
    
    Be careful about racing allocations made while we're scanning for a
    cluster; and hold up allocations made while we're discarding.
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Nick Piggin <nickpiggin@yahoo.com.au>
    Cc: David Woodhouse <dwmw2@infradead.org>
    Cc: Jens Axboe <jens.axboe@oracle.com>
    Cc: Matthew Wilcox <matthew@wil.cx>
    Cc: Joern Engel <joern@logfs.org>
    Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
    Cc: Donjun Shin <djshin90@gmail.com>
    Cc: Tejun Heo <teheo@suse.de>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    7992fde7
swapfile.c 49.1 KB