Re: [PATCH 04/10] mm/madvise: use the PMD softleaf validity helper

From: Lorenzo Stoakes (ARM)

Date: Wed Sep 23 2026 - 12:09:10 EST


On Tue, Sep 22, 2026 at 07:58:24PM -0400, Gregory Price wrote:
> 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) <gourry@xxxxxxxxxx>

LGTM and I like the use of softlaf obviously :)

Reviewed-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>

> ---
> 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
>

--
Cheers, Lorenzo