Re: [RESEND v7 10/29] mm: make PMD migration-entry splitting explicit

From: David Hildenbrand (Arm)

Date: Wed Sep 23 2026 - 07:15:10 EST


Having another look ...


> +
> +/*
> + * Split a present PMD into PTE migration entries, for the rmap migration
> + * walker.

I assume pmd_is_device_private_entry() is also allowed?

"present or device-private PMDs"


> Like split_huge_pmd_locked(), the caller must hold the PMD lock and
> + * must already be inside an mmu_notifier invalidate range.
> + */
> +void split_pmd_to_migration_entries(struct vm_area_struct *vma,
> + unsigned long address, pmd_t *pmd)
> +{
> + VM_WARN_ON_ONCE(!IS_ALIGNED(address, HPAGE_PMD_SIZE));
> + if (pmd_trans_huge(*pmd) || pmd_is_valid_softleaf(*pmd))

pmd_is_valid_softleaf() would include migration entries and swap entries?

I'd assume that try_to_migrate_one() will never call us with something that is
not a present or device-private PMD?

Shouldn't we instead just


VM_WARN_ON_ONCE(!pmd_present(*pmd) && !pmd_is_device_private_entry(*pmd));
__split_huge_pmd_locked(vma, pmd, address, true);

And not offer some weird fallback where we silently don't split?

> + __split_huge_pmd_locked(vma, pmd, address, true);
> }

--
Cheers,

David