Re: [PATCH v4] mm/migrate_device: Clear stale mapping after freeing swapcache
From: David Hildenbrand (Arm)
Date: Thu Jul 30 2026 - 09:12:43 EST
>> While this looks good, I do wonder why do we have to supply the mapping here
>> at all?
>>
>> Is there a path where we call folio_migrate_mapping() and the old folio (folio)
>> does no longer have the right mapping attached?
>>
>> It would be a lot less error prone if the function would just obtain the mapping
>> from the old folio.
>
>
> Agreed. I will make folio_migrate_mapping() obtain the mapping from the source
> folio and update its in-tree callers. Since this changes an exported helper, I
> will send it as a separate patch in v5.
I think it would be good to understand why we currently pass in the folio: was
there ever a reason to do so? Or why do we pass in something that can just
easily be had from the source folio?
But note that that should be a follow-up cleanup to the fix.
--
Cheers,
David