Re: [v4 05/15] mm/migrate_device: handle partially mapped folios during collection
From: Mika Penttilä
Date: Wed Sep 03 2025 - 04:26:26 EST
On 9/3/25 09:05, Balbir Singh wrote:
> On 9/3/25 14:40, Mika Penttilä wrote:
>> Hi,
>>
>> On 9/3/25 04:18, Balbir Singh wrote:
>>
>>> Extend migrate_vma_collect_pmd() to handle partially mapped large
>>> folios that require splitting before migration can proceed.
>>>
>>> During PTE walk in the collection phase, if a large folio is only
>>> partially mapped in the migration range, it must be split to ensure
>>> the folio is correctly migrated.
>>>
> <snip>
>
>>> +
>>> + /*
>>> + * The reason for finding pmd present with a
>>> + * large folio for the pte is partial unmaps.
>>> + * Split the folio now for the migration to be
>>> + * handled correctly
>>> + */
>> There are other reasons like vma splits for various reasons.
>>
> Yes, David had pointed that out as well, I meant to cleanup the comment change
> "The" to "One", I missed addressing it in the refactor, but easy to do
And of course now you split all mTHPs as well, which is different what we do today
(ignoring). Splitting might be the right thing to do, but maybe worth mentioning.
> Thanks,
> Balbir Singh
>
--Mika