Re: [PATCH 3/7] mm/migrate: skip data copy for already-copied folios
From: David Hildenbrand (Arm)
Date: Tue Jun 09 2026 - 09:01:27 EST
On 6/8/26 21:32, Garg, Shivank wrote:
>
>
> On 6/8/2026 9:13 PM, David Hildenbrand (Arm) wrote:
>> On 6/8/26 17:41, Zi Yan wrote:
>>>
>>>
>>> IIRC, multithreaded copy is already gated by CONFIG_HIGHMEM, otherwise
>>> it needs to perform kmap_local() at each copying CPU, which complicates
>>> the process. Then, this code will only used for 32bit without highmem,
>>> I assume there will no page copy DMA on 32bit platform. Maybe it is not
>>> too bad to limit this to 64bit.
>
> I agree.
>
>>
>> I'm more concerned of CONFIG_64BIT handling in the code, but if that can be
>> avoided easily, fine with me.
>
>
> MIGRATION_COPY_OFFLOAD will not be enabled for !64BIT at config.
> config MIGRATION_COPY_OFFLOAD
> bool "Page migration copy offload"
> depends on MIGRATION && 64BIT
Might we worth documenting somewhere why, like ...
>
> I think only place in code we need #ifdef is:
> enum {
> FOLIO_WAS_MAPPED = BIT(0),
> FOLIO_WAS_MLOCKED = BIT(1),
> FOLIO_OLD_STATES = FOLIO_WAS_MAPPED | FOLIO_WAS_MLOCKED,
> #ifdef CONFIG_MIGRATION_COPY_OFFLOAD
> FOLIO_CONTENT_COPIED = BIT(2),
> #else
> FOLIO_CONTENT_COPIED = 0,
... here
/* On 32bit we do not have a spare bit, migration-copy offload is disabled. */
> #endif
> };
>
> With FOLIO_CONTENT_COPIED=0, this will be no operation for its bit operation.
>
> eg:
> const bool already_copied = dst->migrate_info & FOLIO_CONTENT_COPIED;
> evaluates 0 for !64BIT.
If that does the trick, good!
--
Cheers,
David