Re: [PATCH v2] mm/migrate_device: consolidate compound folio handling
From: Hui Su
Date: Sat Sep 12 2026 - 04:53:17 EST
Hi Balbir,
Thanks for the review and the Ack.
> Don't we want to check for *src_pfn == 0?
Yes. I'll avoid setting MIGRATE_PFN_COMPOUND when
migrate_device_pfn_lock() fails.
I don't think we should return 1 immediately when *src_pfn is zero,
though. We should still consume and clear the slots corresponding to the
whole compound folio. Otherwise, the outer loop would advance by only one
entry and the next iteration could treat a tail page of the same folio as
a new source PFN.
So the plan is to keep the folio-sized slot accounting, but only encode
MIGRATE_PFN_COMPOUND when *src_pfn is non-zero, and only do the
unlock/put when the lock succeeded.
> Can we please change this to VM_WARN_ON_ONCE?
Yes, agreed. I'll switch it to VM_WARN_ON_ONCE() and keep the existing
defensive clear-and-stop behavior.
I'll send a v3 with both changes.
Thanks,
Hui