From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CACEB4779BC for ; Tue, 21 Jul 2026 11:32:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784633554; cv=none; b=SdmHP9aV5cfUhHD4ERcU+E3aI0SpV8P21yDY5z4EJuqJIU6tyU1UvaujN1vxGKjLdlbm05s+liiUdjo+KtpjCMKbH7UBIGNPAiPO2vkl+ohN8FU58C/e3v1+dBzgYz1KoX2BoE9OZuV+qt/APGmQ6OkzAfiymS2WXbY8sYBj6vI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784633554; c=relaxed/simple; bh=4M8YRvAbg5aUckFqI/vw24q8l4X8WBOQCIvXv2Oedp4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=LnAMceh8k11ycG9PZuScqysY0pIWkT0+O5LKrutp/4N8M7oFeLZzSE45ccISY7xKcqlGmIM/4H9IS2BBWTaht8XO8GOcyNNHSUAHb64aZvqTwnTWptNgA8zt4Yx+0XhE6ELcm0jhrWFCyv34sBmECZehC0Ihi+fi0zW//pEig3o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=FSdjYrHP; arc=none smtp.client-ip=115.124.30.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="FSdjYrHP" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1784633547; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=AcQT6oTjanxItuAmimd9GFfZe4OYmXP7lT7W50sMfx8=; b=FSdjYrHPKplCgrlQnszGzPaY7bsmiCVhDo9EIMb8Nu4lj57Af76BDQEQY0mBMPCuWazvC5oy35PbHGbxPlpUagdjBxXuUdcLLpE1Up2tiy5HoZImaWiciEIa0zbAS1MH5enUnnx8h1+QPzpU9jSMQCuO8FcnCFBA0vVxBNrHb/s= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037009110;MF=ying.huang@linux.alibaba.com;NM=1;PH=DS;RN=46;SR=0;TI=SMTPD_---0X7ZvAmG_1784633542; Received: from DESKTOP-5N7EMDA(mailfrom:ying.huang@linux.alibaba.com fp:SMTPD_---0X7ZvAmG_1784633542 cluster:ay36) by smtp.aliyun-inc.com; Tue, 21 Jul 2026 19:32:24 +0800 From: "Huang, Ying" To: Zi Yan Cc: Shivank Garg , Andrew Morton , David Hildenbrand , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Alistair Popple , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Karim Manaouil , Frank van der Linden , Teja Vojjala , Pravin Tamkhane , Kinsey Ho , Wei Xu , Matthew Wilcox , Davidlohr Bueso , Vinod Koul , Bharata B Rao , SeongJae Park , David Rientjes , Xuezheng Chu , Yiannis Nikolakopoulos , Dave Hansen , Johannes Weiner , John Hubbard , Peter Xu , Rik van Riel , Shakeel Butt , Tejun Heo , Fan Ni , Jonathan Cameron , "Aneesh Kumar K.V" , Nathan Lynch , Frank Li , Dan Williams , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Day Subject: Re: [PATCH RFC v6 3/5] mm/migrate: add copy offload registration infrastructure In-Reply-To: <19F47514-EBC4-4659-8252-EC3765D9B601@nvidia.com> (Zi Yan's message of "Mon, 20 Jul 2026 10:44:34 -0400") References: <20260630-shivank-batch-migrate-offload-v6-0-da95d7e8b8a2@amd.com> <20260630-shivank-batch-migrate-offload-v6-3-da95d7e8b8a2@amd.com> <87wlupx60s.fsf@DESKTOP-5N7EMDA> <19F47514-EBC4-4659-8252-EC3765D9B601@nvidia.com> Date: Tue, 21 Jul 2026 19:32:22 +0800 Message-ID: <87se5cwpbt.fsf@DESKTOP-5N7EMDA> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Zi Yan writes: > On 20 Jul 2026, at 7:19, Huang, Ying wrote: > >> Shivank Garg 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 >>> #include >>> #include >>> +#include >>> >>> #include >>> >>> @@ -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/ Thanks a lot for your information! Although personally I don't think that it's necessary to optimize for really rare folio_mc_copy() failure cases, I am fine with it if you think that this is the better way. >> >> [snip] >> --- Best Regards, Huang, Ying