diff --git a/mm/swapfile.c b/mm/swapfile.c index 7854322e647c..b63e7fd3d6c6 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1790,6 +1790,13 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd, goto out; } + /* + * Some architectures may have to restore extra metadata to the page + * when reading from swap. This metadata may be indexed by swap entry + * so this must be called before swap_free(). + */ + arch_swap_restore(entry, page_folio(page)); + /* See do_swap_page() */ BUG_ON(!PageAnon(page) && PageMappedToDisk(page)); BUG_ON(PageAnon(page) && PageAnonExclusive(page));