[PATCH next] mm/thp: fix collapse_file()'s try_to_unmap(folio,)
From: Hugh Dickins
Date: Sat Feb 26 2022 - 21:29:05 EST
The foliation of THP collapse_file()'s call to try_to_unmap() is
currently wrong, crashing on a test in rmap_walk() when xas_next()
delivered a value (after which page has been loaded independently).
Fixes: c3b522d9a698 ("mm/rmap: Convert try_to_unmap() to take a folio")
Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
---
Please just fold in if you agree.
mm/khugepaged.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- mmotm/mm/khugepaged.c
+++ linux/mm/khugepaged.c
@@ -1824,7 +1824,8 @@ static void collapse_file(struct mm_stru
}
if (page_mapped(page))
- try_to_unmap(folio, TTU_IGNORE_MLOCK | TTU_BATCH_FLUSH);
+ try_to_unmap(page_folio(page),
+ TTU_IGNORE_MLOCK | TTU_BATCH_FLUSH);
xas_lock_irq(&xas);
xas_set(&xas, index);