lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250319192211.10092-3-shivankg@amd.com>
Date: Wed, 19 Mar 2025 19:22:05 +0000
From: Shivank Garg <shivankg@....com>
To: <akpm@...ux-foundation.org>, <linux-mm@...ck.org>, <ziy@...dia.com>
CC: <AneeshKumar.KizhakeVeetil@....com>, <baolin.wang@...ux.alibaba.com>,
	<bharata@....com>, <david@...hat.com>, <gregory.price@...verge.com>,
	<honggyu.kim@...com>, <jane.chu@...cle.com>, <jhubbard@...dia.com>,
	<jon.grimm@....com>, <k.shutemov@...il.com>, <leesuyeon0506@...il.com>,
	<leillc@...gle.com>, <liam.howlett@...cle.com>,
	<linux-kernel@...r.kernel.org>, <mel.gorman@...il.com>,
	<Michael.Day@....com>, <Raghavendra.KodsaraThimmappa@....com>,
	<riel@...riel.com>, <rientjes@...gle.com>, <santosh.shukla@....com>,
	<shivankg@....com>, <shy828301@...il.com>, <sj@...nel.org>,
	<wangkefeng.wang@...wei.com>, <weixugc@...gle.com>, <willy@...radead.org>,
	<ying.huang@...ux.alibaba.com>, <anannara@....com>, <wei.huang2@....com>,
	<Jonathan.Cameron@...wei.com>, <hyeonggon.yoo@...com>, <byungchul@...com>
Subject: [PATCH RFC V2 2/9] mm/migrate: revive MIGRATE_NO_COPY in migrate_mode.

From: Zi Yan <ziy@...dia.com>

It is a preparation patch. The added MIGRATE_NO_COPY will be used by the
following patches to implement batched page copy functions by skipping
folio copy process in __migrate_folio() and copying folios in one shot
at the end.

Signed-off-by: Zi Yan <ziy@...dia.com>
Signed-off-by: Shivank Garg <shivankg@....com>
---
 include/linux/migrate_mode.h | 2 ++
 mm/migrate.c                 | 8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/linux/migrate_mode.h b/include/linux/migrate_mode.h
index 265c4328b36a..9af6c949a057 100644
--- a/include/linux/migrate_mode.h
+++ b/include/linux/migrate_mode.h
@@ -7,11 +7,13 @@
  *	on most operations but not ->writepage as the potential stall time
  *	is too significant
  * MIGRATE_SYNC will block when migrating pages
+ * MIGRATE_NO_COPY will not copy page content
  */
 enum migrate_mode {
 	MIGRATE_ASYNC,
 	MIGRATE_SYNC_LIGHT,
 	MIGRATE_SYNC,
+	MIGRATE_NO_COPY,
 };
 
 enum migrate_reason {
diff --git a/mm/migrate.c b/mm/migrate.c
index ce7ddc56e878..0d40ac069cea 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -757,9 +757,11 @@ static int __migrate_folio(struct address_space *mapping, struct folio *dst,
 	if (folio_ref_count(src) != expected_count)
 		return -EAGAIN;
 
-	rc = folio_mc_copy(dst, src);
-	if (unlikely(rc))
-		return rc;
+	if (mode != MIGRATE_NO_COPY) {
+		rc = folio_mc_copy(dst, src);
+		if (unlikely(rc))
+			return rc;
+	}
 
 	rc = __folio_migrate_mapping(mapping, dst, src, expected_count);
 	if (rc != MIGRATEPAGE_SUCCESS)
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ