From: Zi Yan <ziy@nvidia.com>
To: "Huang, Ying" <ying.huang@linux.alibaba.com>
Cc: Shivank Garg <shivankg@amd.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Matthew Brost <matthew.brost@intel.com>,
Joshua Hahn <joshua.hahnjy@gmail.com>,
Rakie Kim <rakie.kim@sk.com>, Byungchul Park <byungchul@sk.com>,
Gregory Price <gourry@gourry.net>,
Alistair Popple <apopple@nvidia.com>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Karim Manaouil <kmanaouil.dev@gmail.com>,
Frank van der Linden <fvdl@google.com>,
Teja Vojjala <tejavojjala@google.com>,
Pravin Tamkhane <pravintamkhane@google.com>,
Kinsey Ho <kinseyho@google.com>, Wei Xu <weixugc@google.com>,
Matthew Wilcox <willy@infradead.org>,
Davidlohr Bueso <dave@stgolabs.net>,
Vinod Koul <vkoul@kernel.org>, Bharata B Rao <bharata@amd.com>,
SeongJae Park <sj@kernel.org>,
David Rientjes <rientjes@google.com>,
Xuezheng Chu <xuezhengchu@huawei.com>,
Yiannis Nikolakopoulos <yiannis@zptcorp.com>,
Dave Hansen <dave.hansen@intel.com>,
Johannes Weiner <hannes@cmpxchg.org>,
John Hubbard <jhubbard@nvidia.com>, Peter Xu <peterx@redhat.com>,
Rik van Riel <riel@surriel.com>,
Shakeel Butt <shakeel.butt@linux.dev>, Tejun Heo <tj@kernel.org>,
Fan Ni <nifan.cxl@gmail.com>, Jonathan Cameron <jic23@kernel.org>,
"Aneesh Kumar K.V" <aneesh.kumar@kernel.org>,
Nathan Lynch <nathan.lynch@amd.com>, Frank Li <Frank.li@nxp.com>,
Dan Williams <djbw@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Mike Day <michael.day@amd.com>
Subject: Re: [PATCH RFC v6 3/5] mm/migrate: add copy offload registration infrastructure
Date: Mon, 20 Jul 2026 10:44:34 -0400 [thread overview]
Message-ID: <19F47514-EBC4-4659-8252-EC3765D9B601@nvidia.com> (raw)
In-Reply-To: <87wlupx60s.fsf@DESKTOP-5N7EMDA>
On 20 Jul 2026, at 7:19, Huang, Ying wrote:
> Shivank Garg <shivankg@amd.com> writes:
>
> [snip]
>
>> diff --git a/mm/migrate.c b/mm/migrate.c
>> index 41b732e78a67..4fed3110ca0a 100644
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -43,6 +43,7 @@
>> #include <linux/sched/sysctl.h>
>> #include <linux/memory-tiers.h>
>> #include <linux/pagewalk.h>
>> +#include <linux/migrate_copy_offload.h>
>>
>> #include <asm/tlbflush.h>
>>
>> @@ -51,12 +52,6 @@
>> #include "internal.h"
>> #include "swap.h"
>>
>> -/* For now, never offload. Wired up in later patch. */
>> -static bool migrate_should_offload(int reason)
>> -{
>> - return false;
>> -}
>> -
>> static const struct movable_operations *offline_movable_ops;
>> static const struct movable_operations *zsmalloc_movable_ops;
>>
>> @@ -2050,7 +2045,7 @@ static int migrate_pages_batch(struct list_head *from,
>>
>> /* Batch-copy eligible folios before the move phase */
>> if (!list_empty(&unmap_batch))
>> - migrate_folios_mc_copy(&dst_batch, &unmap_batch, nr_batch);
>> + migrate_offload_batch_copy(&dst_batch, &unmap_batch, nr_batch);
>>
>> retry = 1;
>> for (pass = 0; pass < nr_pass && retry; pass++) {
>
> Found a difference between v5 and v6 here. In v5, migrate_pages_batch()
> checks the return value of migrate_offload_batch_copy() and acts
> accordingly. While in v6, it does not. Why was this changed?
>
> IIUC, FOLIO_CONTENT_COPIED is now used to indicate a copy failure. Is
> this necessary? Is it possible that some (but not all) folios fail to
> be copied?
Based on the discussion[1], FOLIO_CONTENT_COPIED is used to indicate both
1. folio is copied via offloading, and 2. MC copy failure. So the code
no longer needs to store the return value of migrate_offload_batch_copy()
and can just check dst->migrate_info & FOLIO_CONTENT_COPIED.
For 32bit, FOLIO_CONTENT_COPIED is always 0, so all folios are always
copied in the serialized path. Hmm, that might be causing double copying,
since migrate_folios_mc_copy() copies batched folios and later
migrate_folios_move() copies them again since
dst->migrate_info & FOLIO_CONTENT_COPIED is always false. Maybe we could
make migrate_folios_mc_copy() return immediately in 32bit, otherwise,
we will need to find somewhere else to store FOLIO_CONTENT_COPIED.
[1] https://lore.kernel.org/all/c2bfdf39-8caa-43bd-b1ad-2285b4cc767a@amd.com/
>
> [snip]
>
> ---
> Best Regards,
> Huang, Ying
Best Regards,
Yan, Zi
next prev parent reply other threads:[~2026-07-20 14:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 7:28 [PATCH RFC v6 0/5] Accelerate page migration with batch copying and hardware offload Shivank Garg
2026-06-30 7:28 ` [PATCH RFC v6 1/5] mm/migrate: skip data copy for already-copied folios Shivank Garg
2026-06-30 7:28 ` [PATCH RFC v6 2/5] mm/migrate: add batch-copy path in migrate_pages_batch Shivank Garg
2026-06-30 7:28 ` [PATCH RFC v6 3/5] mm/migrate: add copy offload registration infrastructure Shivank Garg
2026-07-20 11:19 ` Huang, Ying
2026-07-20 14:44 ` Zi Yan [this message]
2026-07-20 15:32 ` Garg, Shivank
2026-07-20 15:45 ` Zi Yan
2026-07-21 11:32 ` Huang, Ying
2026-06-30 7:28 ` [PATCH RFC v6 4/5] drivers/migrate_offload: add DMA batch copy driver (dcbm) Shivank Garg
2026-06-30 7:28 ` [PATCH RFC v6 5/5] mm/migrate: adjust NR_MAX_BATCHED_MIGRATION for testing Shivank Garg
2026-07-14 11:29 ` [PATCH RFC v6 0/5] Accelerate page migration with batch copying and hardware offload Huang, Ying
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19F47514-EBC4-4659-8252-EC3765D9B601@nvidia.com \
--to=ziy@nvidia.com \
--cc=Frank.li@nxp.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@kernel.org \
--cc=apopple@nvidia.com \
--cc=bharata@amd.com \
--cc=byungchul@sk.com \
--cc=dave.hansen@intel.com \
--cc=dave@stgolabs.net \
--cc=david@kernel.org \
--cc=djbw@kernel.org \
--cc=fvdl@google.com \
--cc=gourry@gourry.net \
--cc=hannes@cmpxchg.org \
--cc=jhubbard@nvidia.com \
--cc=jic23@kernel.org \
--cc=joshua.hahnjy@gmail.com \
--cc=kinseyho@google.com \
--cc=kmanaouil.dev@gmail.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=matthew.brost@intel.com \
--cc=mhocko@suse.com \
--cc=michael.day@amd.com \
--cc=nathan.lynch@amd.com \
--cc=nifan.cxl@gmail.com \
--cc=peterx@redhat.com \
--cc=pravintamkhane@google.com \
--cc=rakie.kim@sk.com \
--cc=riel@surriel.com \
--cc=rientjes@google.com \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=shivankg@amd.com \
--cc=sj@kernel.org \
--cc=surenb@google.com \
--cc=tejavojjala@google.com \
--cc=tj@kernel.org \
--cc=vbabka@kernel.org \
--cc=vkoul@kernel.org \
--cc=weixugc@google.com \
--cc=willy@infradead.org \
--cc=xuezhengchu@huawei.com \
--cc=yiannis@zptcorp.com \
--cc=ying.huang@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®