Linux/linux 64165b1mm swapfile.c

mm: swapoff: take notice of completion sooner

The old try_to_unuse() implementation was driven by find_next_to_unuse(),
which terminated as soon as all the swap had been freed.

Add inuse_pages checks now (alongside signal_pending()) to stop scanning
mms and swap_map once finished.

The same ought to be done in shmem_unuse() too, but never was before,
and needs a different interface: so leave it as is for now.

Link: http://lkml.kernel.org/r/alpine.LSU.2.11.1904081258200.1523@eggly.anvils
Fixes: b56a2d8af914 ("mm: rid swapoff of quadratic complexity")
Signed-off-by: Hugh Dickins <hughd at google.com>
Cc: "Alex Xu (Hello71)" <alex_y_xu at yahoo.ca>
Cc: Huang Ying <ying.huang at intel.com>
Cc: Kelley Nielsen <kelleynnn at gmail.com>
Cc: Konstantin Khlebnikov <khlebnikov at yandex-team.ru>
Cc: Rik van Riel <riel at surriel.com>
Cc: Vineeth Pillai <vpillai at digitalocean.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
DeltaFile
+11-8mm/swapfile.c
+11-81 files

UnifiedSplitRaw