diff --git a/mm/swapfile.c b/mm/swapfile.c index cad0209ac67f..d996c335fc3c 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1778,6 +1778,13 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd, goto setpte; } + /* + * 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));