blob: d2a3d3c313829fabde14b9326b7948711e87c722 [file] [log] [blame]
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
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@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
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);
_