At swapoff time, we're going to swap in the pages continuously. So calling lookup_swap_cache would confuse statistics. We should use find_get_page directly here. Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> --- mm/swapfile.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 960d14a4b19e..e033a53a99df 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1865,7 +1865,12 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd, offset = swp_offset(entry); pte_unmap(pte); swap_map = &si->swap_map[offset]; - page = lookup_swap_cache(entry, vma, addr); + /* + * Since we're going to swap in the pages continuously, + * calling lookup_swap_cache() would confuse statistics. + */ + page = find_get_page(swap_address_space(entry), + swp_offset(entry)); if (!page) { struct vm_fault vmf = { .vma = vma, -- 2.23.0