linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: akpm@linux-foundation.org, willy@infradead.org,
	apopple@nvidia.com, Sidhartha Kumar <sidhartha.kumar@oracle.com>
Subject: [PATCH v2 5/6] mm/migrate_device: convert migrate_device_coherent_page() to migrate_device_coherent_folio()
Date: Fri, 16 Feb 2024 13:13:19 -0800	[thread overview]
Message-ID: <20240216211320.222431-5-sidhartha.kumar@oracle.com> (raw)
In-Reply-To: <20240216211320.222431-1-sidhartha.kumar@oracle.com>

Rename migrate_device_coherent_page() to migrate_device_coherent_folio()
as it now takes in a folio.

Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
---
 mm/gup.c            |  2 +-
 mm/internal.h       |  2 +-
 mm/migrate_device.c | 12 ++++++------
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index df83182ec72d5..2c8b183b94485 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -2109,7 +2109,7 @@ static int migrate_longterm_unpinnable_pages(
 			folio_get(folio);
 			gup_put_folio(folio, 1, FOLL_PIN);
 
-			if (migrate_device_coherent_page(&folio->page)) {
+			if (migrate_device_coherent_folio(folio)) {
 				ret = -EBUSY;
 				goto err;
 			}
diff --git a/mm/internal.h b/mm/internal.h
index c6ea449c5353c..32304bec79f3f 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -1003,7 +1003,7 @@ int numa_migrate_prep(struct folio *folio, struct vm_area_struct *vma,
 		      unsigned long addr, int page_nid, int *flags);
 
 void free_zone_device_page(struct page *page);
-int migrate_device_coherent_page(struct page *page);
+int migrate_device_coherent_folio(struct folio *folio);
 
 /*
  * mm/gup.c
diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index d9633c7b1d21b..5c239de0f08b2 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -705,7 +705,7 @@ static void __migrate_device_pages(unsigned long *src_pfns,
 
 			/*
 			 * The only time there is no vma is when called from
-			 * migrate_device_coherent_page(). However this isn't
+			 * migrate_device_coherent_folio(). However this isn't
 			 * called if the page could not be unmapped.
 			 */
 			VM_BUG_ON(!migrate);
@@ -915,15 +915,15 @@ EXPORT_SYMBOL(migrate_device_range);
  * a reference on page which will be copied to the new page if migration is
  * successful or dropped on failure.
  */
-int migrate_device_coherent_page(struct page *page)
+int migrate_device_coherent_folio(struct folio *folio)
 {
 	unsigned long src_pfn, dst_pfn = 0;
 	struct page *dpage;
 
-	WARN_ON_ONCE(PageCompound(page));
+	WARN_ON_ONCE(folio_test_large(folio));
 
-	lock_page(page);
-	src_pfn = migrate_pfn(page_to_pfn(page)) | MIGRATE_PFN_MIGRATE;
+	folio_lock(folio);
+	src_pfn = migrate_pfn(folio_pfn(folio)) | MIGRATE_PFN_MIGRATE;
 
 	/*
 	 * We don't have a VMA and don't need to walk the page tables to find
@@ -942,7 +942,7 @@ int migrate_device_coherent_page(struct page *page)
 
 	migrate_device_pages(&src_pfn, &dst_pfn, 1);
 	if (src_pfn & MIGRATE_PFN_MIGRATE)
-		copy_highpage(dpage, page);
+		copy_highpage(dpage, &folio->page);
 	migrate_device_finalize(&src_pfn, &dst_pfn, 1);
 
 	if (src_pfn & MIGRATE_PFN_MIGRATE)
-- 
2.42.0



  parent reply	other threads:[~2024-02-16 21:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 21:13 [PATCH v2 1/6] mm/migrate: introduce migrate_pfn_to_folio() Sidhartha Kumar
2024-02-16 21:13 ` [PATCH v2 2/6] mm/migrate_device: further convert migrate_device_unmap() to folios Sidhartha Kumar
2024-02-16 21:51   ` Matthew Wilcox
2024-02-16 21:13 ` [PATCH v2 3/6] mm/migrate_device: further convert migrate_device_finalize() " Sidhartha Kumar
2024-02-16 21:13 ` [PATCH v2 4/6] mm/migrate_device: convert __migrate_device_pages() " Sidhartha Kumar
2024-02-16 21:55   ` Matthew Wilcox
2024-02-16 22:00     ` Sidhartha Kumar
2024-02-16 23:19       ` Matthew Wilcox
2024-02-19  9:49         ` Alistair Popple
2024-02-16 21:13 ` Sidhartha Kumar [this message]
2024-02-16 21:13 ` [PATCH v2 6/6] mm/migrate_device: convert migrate_device_range() " Sidhartha Kumar
2024-02-16 21:50 ` [PATCH v2 1/6] mm/migrate: introduce migrate_pfn_to_folio() Matthew Wilcox
2024-02-16 22:03   ` Sidhartha Kumar

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=20240216211320.222431-5-sidhartha.kumar@oracle.com \
    --to=sidhartha.kumar@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /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