Re: [PATCH v3] mm/migrate_device: Clear stale mapping after freeing swapcache
From: Andrew Morton
Date: Mon Jul 27 2026 - 18:43:45 EST
On Mon, 27 Jul 2026 16:28:42 +0530 "Yadav, Arvind" <arvind.yadav@xxxxxxxxx> wrote:
> >> --- a/mm/migrate_device.c
> >> +++ b/mm/migrate_device.c
> >> @@ -1182,6 +1182,11 @@ static void __migrate_device_pages(unsigned long *src_pfns,
> >> MIGRATE_PFN_COMPOUND);
> >> goto next;
> >> }
> >> + /*
> >> + * reset nr so that only first after-split folio
> >> + * is processed below
> >> + */
> >> + nr = 1;
> > We should also add a VM_WARN_ON_ONCE(folio_test_swapcache(folio))
>
>
> Agreed , but folio_test_swapcache() is not valid immediately after the
> split, as the order-0 folios may still be in swapcache.
> I’ll use just before nr = 1
AI review suggest there might be another bug in here:
https://sashiko.dev/#/patchset/20260727053920.3494211-1-arvind.yadav@xxxxxxxxx