The patch titled Subject: mm: simplify the assertions in unuse_pte() has been added to the -mm mm-unstable branch. Its filename is mm-simplify-the-assertions-in-unuse_pte.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-simplify-the-assertions-in-unuse_pte.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> Subject: mm: simplify the assertions in unuse_pte() Date: Mon, 11 Dec 2023 16:22:07 +0000 We should only see anon folios in this function (and there are many assumptions of that already), so we can simplify these two assertions. Link: https://lkml.kernel.org/r/20231211162214.2146080-3-willy@xxxxxxxxxxxxx Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/swapfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/swapfile.c~mm-simplify-the-assertions-in-unuse_pte +++ a/mm/swapfile.c @@ -1789,8 +1789,8 @@ static int unuse_pte(struct vm_area_stru arch_swap_restore(entry, page_folio(page)); /* See do_swap_page() */ - BUG_ON(!PageAnon(page) && PageMappedToDisk(page)); - BUG_ON(PageAnon(page) && PageAnonExclusive(page)); + VM_BUG_ON_FOLIO(!folio_test_anon(folio), folio); + VM_BUG_ON_PAGE(PageAnonExclusive(page), page); dec_mm_counter(vma->vm_mm, MM_SWAPENTS); inc_mm_counter(vma->vm_mm, MM_ANONPAGES); _ Patches currently in -mm which might be from willy@xxxxxxxxxxxxx are buffer-return-bool-from-grow_dev_folio.patch buffer-calculate-block-number-inside-folio_init_buffers.patch buffer-fix-grow_buffers-for-block-size-page_size.patch buffer-cast-block-to-loff_t-before-shifting-it.patch buffer-fix-various-functions-for-block-size-page_size.patch buffer-handle-large-folios-in-__block_write_begin_int.patch buffer-fix-more-functions-for-block-size-page_size.patch mm-convert-ksm_might_need_to_copy-to-work-on-folios.patch mm-simplify-the-assertions-in-unuse_pte.patch mm-convert-unuse_pte-to-use-a-folio-throughout.patch mm-remove-some-calls-to-page_add_new_anon_rmap.patch mm-remove-stale-example-from-comment.patch mm-remove-references-to-page_add_new_anon_rmap-in-comments.patch mm-convert-migrate_vma_insert_page-to-use-a-folio.patch mm-convert-collapse_huge_page-to-use-a-folio.patch mm-remove-page_add_new_anon_rmap-and-lru_cache_add_inactive_or_unevictable.patch