Re: [PATCH v3 3/3] mm/huge_memory: skip device-private PMDs in madvise_free_huge_pmd
From: Gregory Price
Date: Sun Jul 12 2026 - 08:47:15 EST
On Fri, Jul 10, 2026 at 03:55:23AM -0700, Usama Arif wrote:
>
> Fixes: 368076f52ebe ("mm/huge_memory: add device-private THP support to PMD operations")
> Cc: <stable@xxxxxxxxxxxxxxx>
> Reviewed-by: Joshua Hahn <joshua.hahnjy@xxxxxxxxx>
> Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>
> Reviewed-by: Balbir Singh <balbirs@xxxxxxxxxx>
> Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>
Reviewed-by: Gregory Price <gourry@xxxxxxxxxx>
> ---
> mm/huge_memory.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index c0892cc533a9..7ae21b006b68 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2297,8 +2297,8 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
> goto out;
>
> if (unlikely(!pmd_present(orig_pmd))) {
> - VM_BUG_ON(thp_migration_supported() &&
> - !pmd_is_migration_entry(orig_pmd));
> + VM_WARN_ON_ONCE(!pmd_is_migration_entry(orig_pmd) &&
> + !pmd_is_device_private_entry(orig_pmd));
I just realized, are there softleaf entries we wouldn't want to WARN on?
If not, should all three of these patches just be something like
pmd_is_softleaf()?
x_is_softleaf() does not exist, just curious if it should, and not
worth holding up the patch.
~Gregory