[PATCH v3 08/14] mm/khugepaged: Remove redundant pmd_devmap() check

Alistair Popple apopple at nvidia.com
Thu Jun 19 18:58:00 AEST 2025


The pmd_devmap() check in check_pmd_state() is redundant because the
only user of pmd_devmap were device dax and fs dax. However all callers
of check_pmd_state() first call thp_vma_allowable_order() to check if
the vma should be scanned. Except when called from a page fault this
always returns 0 for dax vma's, hence we would never expect to see a
pmd_devmap entry.

Signed-off-by: Alistair Popple <apopple at nvidia.com>
Acked-by: David Hildenbrand <david at redhat.com>
Reviewed-by: Jason Gunthorpe <jgg at nvidia.com>

---

Changes from v2:

 - Update commit message to better reflect why the check was redundant
---
 mm/khugepaged.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 15203ea..d45d08b 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -945,8 +945,6 @@ static inline int check_pmd_state(pmd_t *pmd)
 		return SCAN_PMD_NULL;
 	if (pmd_trans_huge(pmde))
 		return SCAN_PMD_MAPPED;
-	if (pmd_devmap(pmde))
-		return SCAN_PMD_NULL;
 	if (pmd_bad(pmde))
 		return SCAN_PMD_NULL;
 	return SCAN_SUCCEED;
-- 
git-series 0.9.1


More information about the Linuxppc-dev mailing list