Linux-FSCrypt Archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-fsdevel@vger.kernel.org, linux-fscrypt@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: [PATCH 4/6] migrate: Expand the use of folio in __migrate_device_pages()
Date: Tue, 23 Apr 2024 23:55:35 +0100	[thread overview]
Message-ID: <20240423225552.4113447-5-willy@infradead.org> (raw)
In-Reply-To: <20240423225552.4113447-1-willy@infradead.org>

Removes a few calls to compound_head() and a call to page_mapping().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/migrate_device.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index a68616c1965f..aecc71972a87 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -692,6 +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;
 		int r;
 
 		if (!newpage) {
@@ -726,15 +727,12 @@ static void __migrate_device_pages(unsigned long *src_pfns,
 			continue;
 		}
 
-		mapping = page_mapping(page);
+		folio = page_folio(page);
+		mapping = folio_mapping(folio);
 
 		if (is_device_private_page(newpage) ||
 		    is_device_coherent_page(newpage)) {
 			if (mapping) {
-				struct folio *folio;
-
-				folio = page_folio(page);
-
 				/*
 				 * For now only support anonymous memory migrating to
 				 * device private or coherent memory.
@@ -757,11 +755,10 @@ static void __migrate_device_pages(unsigned long *src_pfns,
 
 		if (migrate && migrate->fault_page == page)
 			r = migrate_folio_extra(mapping, page_folio(newpage),
-						page_folio(page),
-						MIGRATE_SYNC_NO_COPY, 1);
+						folio, MIGRATE_SYNC_NO_COPY, 1);
 		else
 			r = migrate_folio(mapping, page_folio(newpage),
-					page_folio(page), MIGRATE_SYNC_NO_COPY);
+					folio, MIGRATE_SYNC_NO_COPY);
 		if (r != MIGRATEPAGE_SUCCESS)
 			src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
 	}
-- 
2.43.0


  parent reply	other threads:[~2024-04-23 22:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 22:55 [PATCH 0/6] Remove page_mapping() Matthew Wilcox (Oracle)
2024-04-23 22:55 ` [PATCH 1/6] fscrypt: Convert bh_get_inode_and_lblk_num to use a folio Matthew Wilcox (Oracle)
2024-04-23 23:34   ` Eric Biggers
2024-04-24 11:53   ` David Hildenbrand
2024-04-23 22:55 ` [PATCH 2/6] f2fs: Convert f2fs_clear_page_cache_dirty_tag " Matthew Wilcox (Oracle)
2024-04-24 11:53   ` David Hildenbrand
2024-04-23 22:55 ` [PATCH 3/6] memory-failure: Remove calls to page_mapping() Matthew Wilcox (Oracle)
2024-04-23 23:52   ` Sidhartha Kumar
2024-04-24 11:54   ` David Hildenbrand
2024-04-25  6:21   ` Miaohe Lin
2024-04-23 22:55 ` Matthew Wilcox (Oracle) [this message]
2024-04-24 11:54   ` [PATCH 4/6] migrate: Expand the use of folio in __migrate_device_pages() David Hildenbrand
2024-04-23 22:55 ` [PATCH 5/6] userfault; Expand folio use in mfill_atomic_install_pte() Matthew Wilcox (Oracle)
2024-04-24 11:55   ` David Hildenbrand
2024-04-23 22:55 ` [PATCH 6/6] mm: Remove page_mapping() Matthew Wilcox (Oracle)
2024-04-24 11:55   ` David Hildenbrand
2024-04-24 23:34     ` Andrew Morton
2024-04-24 23:59       ` Matthew Wilcox
2024-05-20 21:16 ` [f2fs-dev] [PATCH 0/6] " patchwork-bot+f2fs

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=20240423225552.4113447-5-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).