A non-present huge PMD must contain a software leaf type supported at
PMD level. The open-coded check names the currently supported migration
and device-private entries instead of expressing that invariant.

Use pmd_is_valid_softleaf() so the validation follows the central
definition of valid PMD softleaf entries.

No functional change intended.

Assisted-by: LLM
Signed-off-by: Gregory Price (Meta) <[email protected]>
---
 mm/madvise.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/madvise.c b/mm/madvise.c
index c345fef23f15d..b31b877c2c130 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -427,8 +427,7 @@ static int madvise_lru_pmd_entry(pmd_t *pmd, unsigned long 
addr,
 
                orig_pmd = *pmd;
                if (unlikely(!pmd_present(orig_pmd))) {
-                       VM_WARN_ON_ONCE(!pmd_is_migration_entry(orig_pmd) &&
-                                       !pmd_is_device_private_entry(orig_pmd));
+                       VM_WARN_ON_ONCE(!pmd_is_valid_softleaf(orig_pmd));
                        goto huge_unlock;
                }
 
-- 
2.53.0-Meta


Reply via email to