linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: <akpm@linux-foundation.org>, <linux-mm@kvack.org>
Cc: Tony Luck <tony.luck@intel.com>,
	Miaohe Lin <linmiaohe@huawei.com>, <nao.horiguchi@gmail.com>,
	Matthew Wilcox <willy@infradead.org>,
	David Hildenbrand <david@redhat.com>,
	Muchun Song <muchun.song@linux.dev>,
	Benjamin LaHaise <bcrl@kvack.org>, <jglisse@redhat.com>,
	Zi Yan <ziy@nvidia.com>, Jiaqi Yan <jiaqiyan@google.com>,
	Hugh Dickins <hughd@google.com>,
	Vishal Moola <vishal.moola@gmail.com>,
	Alistair Popple <apopple@nvidia.com>,
	Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: [PATCH 2/5] mm: migrate_device: use a newfolio in __migrate_device_pages()
Date: Fri, 24 May 2024 13:28:40 +0800	[thread overview]
Message-ID: <20240524052843.182275-3-wangkefeng.wang@huawei.com> (raw)
In-Reply-To: <20240524052843.182275-1-wangkefeng.wang@huawei.com>

Use a newfolio instead of newpage and convert to more folio api in
__migrate_device_pages().

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 mm/migrate_device.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index aecc71972a87..f5e034de718a 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -692,7 +692,7 @@ static void __migrate_device_pages(unsigned long *src_pfns,
 		struct page *newpage = migrate_pfn_to_page(dst_pfns[i]);
 		struct page *page = migrate_pfn_to_page(src_pfns[i]);
 		struct address_space *mapping;
-		struct folio *folio;
+		struct folio *newfolio, *folio;
 		int r;
 
 		if (!newpage) {
@@ -727,11 +727,12 @@ static void __migrate_device_pages(unsigned long *src_pfns,
 			continue;
 		}
 
+		newfolio = page_folio(newpage);
 		folio = page_folio(page);
 		mapping = folio_mapping(folio);
 
-		if (is_device_private_page(newpage) ||
-		    is_device_coherent_page(newpage)) {
+		if (folio_is_device_private(newfolio) ||
+		    folio_is_device_coherent(newfolio)) {
 			if (mapping) {
 				/*
 				 * For now only support anonymous memory migrating to
@@ -745,7 +746,7 @@ static void __migrate_device_pages(unsigned long *src_pfns,
 					continue;
 				}
 			}
-		} else if (is_zone_device_page(newpage)) {
+		} else if (folio_is_zone_device(newfolio)) {
 			/*
 			 * Other types of ZONE_DEVICE page are not supported.
 			 */
@@ -754,11 +755,11 @@ static void __migrate_device_pages(unsigned long *src_pfns,
 		}
 
 		if (migrate && migrate->fault_page == page)
-			r = migrate_folio_extra(mapping, page_folio(newpage),
-						folio, MIGRATE_SYNC_NO_COPY, 1);
+			r = migrate_folio_extra(mapping, newfolio, folio,
+						MIGRATE_SYNC_NO_COPY, 1);
 		else
-			r = migrate_folio(mapping, page_folio(newpage),
-					folio, MIGRATE_SYNC_NO_COPY);
+			r = migrate_folio(mapping, newfolio, folio,
+					  MIGRATE_SYNC_NO_COPY);
 		if (r != MIGRATEPAGE_SUCCESS)
 			src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
 	}
-- 
2.27.0



  parent reply	other threads:[~2024-05-24  5:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24  5:28 [PATCH 0/5] mm: cleanup MIGRATE_SYNC_NO_COPY mode Kefeng Wang
2024-05-24  5:28 ` [PATCH 1/5] mm: migrate: simplify __buffer_migrate_folio() Kefeng Wang
2024-05-24  5:28 ` Kefeng Wang [this message]
2024-05-24  5:28 ` [PATCH 3/5] mm: migrate_device: unify migrate folio for MIGRATE_SYNC_NO_COPY Kefeng Wang
2024-06-07 20:23   ` Jane Chu
2024-05-24  5:28 ` [PATCH 4/5] mm: migrate: remove migrate_folio_extra() Kefeng Wang
2024-06-07 20:38   ` Jane Chu
2024-05-24  5:28 ` [PATCH 5/5] mm: remove MIGRATE_SYNC_NO_COPY mode Kefeng Wang
2024-06-07 21:27   ` Jane Chu

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=20240524052843.182275-3-wangkefeng.wang@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=bcrl@kvack.org \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=jglisse@redhat.com \
    --cc=jiaqiyan@google.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=nao.horiguchi@gmail.com \
    --cc=tony.luck@intel.com \
    --cc=vishal.moola@gmail.com \
    --cc=willy@infradead.org \
    --cc=ziy@nvidia.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