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.
Fixes: b56a2d8af914 ("mm: rid swapoff of quadratic complexity")
Signed-off-by: Hugh Dickins <firstname.lastname@example.org>
Cc: "Alex Xu (Hello71)" <email@example.com>
Cc: Huang Ying <firstname.lastname@example.org>
Cc: Kelley Nielsen <email@example.com>
Cc: Konstantin Khlebnikov <firstname.lastname@example.org>
Cc: Rik van Riel <email@example.com>
Cc: Vineeth Pillai <firstname.lastname@example.org>
Signed-off-by: Andrew Morton <email@example.com>
Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
1 file changed