VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Miaohe Lin <linmiaohe@huawei.com> 2021-09-02 14:59:39 -0700 committer: Linus Torvalds <torvalds@linux-foundation.org> 2021-09-03 09:58:17 -0700 commit: d17be2d9ff6c689fd70d2d451153d613508a56ae parent: 9647875be52b33fe22cb034ec3074896c581543f
Commit Summary:
mm/vmscan: remove the PageDirty check after MADV_FREE pages are page_ref_freezed
Diffstat:
1 file changed, 8 insertions, 5 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2255025f1891..044207d0bb66 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1732,11 +1732,14 @@ retry:
 			/* follow __remove_mapping for reference */
 			if (!page_ref_freeze(page, 1))
 				goto keep_locked;
-			if (PageDirty(page)) {
-				page_ref_unfreeze(page, 1);
-				goto keep_locked;
-			}
-
+			/*
+			 * The page has only one reference left, which is
+			 * from the isolation. After the caller puts the
+			 * page back on lru and drops the reference, the
+			 * page will be freed anyway. It doesn't matter
+			 * which lru it goes. So we don't bother checking
+			 * PageDirty here.
+			 */
 			count_vm_event(PGLAZYFREED);
 			count_memcg_page_event(page, PGLAZYFREED);
 		} else if (!mapping || !__remove_mapping(mapping, page, true,