Re: [PATCH v4] mm/migrate_device: Clear stale mapping after freeing swapcache
From: Yadav, Arvind
Date: Fri Jul 31 2026 - 00:49:15 EST
On 30-07-2026 18:17, David Hildenbrand (Arm) wrote:
I think it would be good to understand why we currently pass in the folio: wasWhile 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.
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.
Thanks for the suggestion. Once this is merged, I will review the history and callers to confirm whether any path intentionally uses a mapping other than folio_mapping(src) and follow up with a separate cleanup patch if needed.
Thanks,
Arvind