[PATCH 3/4] mm: Warn for unstable pmd in move_page_tables()

Peter Xu posted 4 patches 2 years, 8 months ago
[PATCH 3/4] mm: Warn for unstable pmd in move_page_tables()
Posted by Peter Xu 2 years, 8 months ago
We already hold write mmap lock here, not possible to trigger unstable
pmd.  Make it a WARN_ON_ONCE instead.

Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
 mm/mremap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mremap.c b/mm/mremap.c
index da107f2c71bf..9303e4da4e7f 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -544,8 +544,8 @@ unsigned long move_page_tables(struct vm_area_struct *vma,
 					   old_pmd, new_pmd, need_rmap_locks))
 				continue;
 			split_huge_pmd(vma, old_pmd, old_addr);
-			if (pmd_trans_unstable(old_pmd))
-				continue;
+			/* We're with the mmap write lock, not possible to happen */
+			WARN_ON_ONCE(pmd_trans_unstable(old_pmd));
 		} else if (IS_ENABLED(CONFIG_HAVE_MOVE_PMD) &&
 			   extent == PMD_SIZE) {
 			/*
-- 
2.40.1