Skip to contentSkip to conversation

mm: convert try_to_unmap_one() to use page_vma_mapped_walk()

PATCH New [email protected] 1 participant 1 message Feb 24, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 49/124 mm: convert try_to_unmap_one() to use page_vma_mapped_walk()

From: "Kirill A. Shutemov" <[email protected]>
Subject: mm: convert try_to_unmap_one() to use page_vma_mapped_walk()

For consistency, it worth converting all page_check_address() to page_vma_mapped_walk(), so we could drop the former.

It also makes freeze_page() as we walk though rmap only once.

Cc Andrea Arcangeli <[email protected]>
Cc Hillf Danton <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Oleg Nesterov <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Srikar Dronamraju <[email protected]>
Cc Vladimir Davydov <[email protected]>

---

 mm/huge_memory.c |   16 --
 mm/rmap.c        |  260 +++++++++++++++++++++++----------------------
 2 files changed, 137 insertions(+), 139 deletions(-)
mm/huge_memory.c renamed from mm/huge_memory.c~mm-convert-try_to_unmap_one-to-use-page_vma_mapped_walk +4 -12
diff -puN mm/huge_memory.c~mm-convert-try_to_unmap_one-to-use-page_vma_mapped_walk mm/huge_memory.c
@@ -2106,24 +2106,16 @@ void vma_adjust_trans_huge(struct vm_are
 static void freeze_page(struct page *page)
 {
 	enum ttu_flags ttu_flags = TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS |
-		TTU_RMAP_LOCKED;
-	int i, ret;
+		TTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD;
+	int ret;
 
 	VM_BUG_ON_PAGE(!PageHead(page), page);
 
 	if (PageAnon(page))
 		ttu_flags |= TTU_MIGRATION;
 
-	/* We only need TTU_SPLIT_HUGE_PMD once */
-	ret = try_to_unmap(page, ttu_flags | TTU_SPLIT_HUGE_PMD);
-	for (i = 1; !ret && i < HPAGE_PMD_NR; i++) {
-		/* Cut short if the page is unmapped */
-		if (page_count(page) == 1)
-			return;
-
-		ret = try_to_unmap(page + i, ttu_flags);
-	}
-	VM_BUG_ON_PAGE(ret, page + i - 1);
+	ret = try_to_unmap(page, ttu_flags);
+	VM_BUG_ON_PAGE(ret, page);
 }
 
 static void unfreeze_page(struct page *page)
mm/rmap.c renamed from mm/rmap.c~mm-convert-try_to_unmap_one-to-use-page_vma_mapped_walk +129 -121

291 lines not on this page · raw message