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

From: Peter Xu
Date: Fri Jun 02 2023 - 19:06:59 EST


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@xxxxxxx>
Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
---
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