[PATCH] mm/gup.c: stricter check on THP migration entry during follow_pmd_mask

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When BUG_ON check for THP migration entry, we need also consider
!thp_migration_supported() case, becaouse it is invalid at the code
context. Now, make this check been covered without adding extra cost.

Because pmdval instead of *pmd is read, so just call
pmd_migration_entry_wait().

Signed-off-by: Li Xinhai <lixinhai.lxh@xxxxxxxxx>
---
 mm/gup.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index 2c51e9748a6a..49f490bae030 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -644,10 +644,9 @@ static struct page *follow_pmd_mask(struct vm_area_struct *vma,
 	if (!pmd_present(pmdval)) {
 		if (likely(!(flags & FOLL_MIGRATION)))
 			return no_page_table(vma, flags);
-		VM_BUG_ON(thp_migration_supported() &&
+		VM_BUG_ON(!thp_migration_supported() ||
 				  !is_pmd_migration_entry(pmdval));
-		if (is_pmd_migration_entry(pmdval))
-			pmd_migration_entry_wait(mm, pmd);
+		pmd_migration_entry_wait(mm, pmd);
 		pmdval = READ_ONCE(*pmd);
 		/*
 		 * MADV_DONTNEED may convert the pmd to null because
-- 
2.27.0





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux