From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, linux-mm@kvack.org
Subject: [PATCH 1/4] mm/huge_memory: Convert split_huge_pages_in_file() to use a folio
Date: Wed, 19 Oct 2022 19:33:29 +0100 [thread overview]
Message-ID: <20221019183332.2802139-2-willy@infradead.org> (raw)
In-Reply-To: <20221019183332.2802139-1-willy@infradead.org>
Removes a number of calls to compound_head() and a call to
pagecache_get_page().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
mm/huge_memory.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 1cc4a5f4791e..6d9ca4819d68 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3057,28 +3057,28 @@ static int split_huge_pages_in_file(const char *file_path, pgoff_t off_start,
mapping = candidate->f_mapping;
for (index = off_start; index < off_end; index += nr_pages) {
- struct page *fpage = pagecache_get_page(mapping, index,
- FGP_ENTRY | FGP_HEAD, 0);
+ struct folio *folio = __filemap_get_folio(mapping, index,
+ FGP_ENTRY, 0);
nr_pages = 1;
- if (xa_is_value(fpage) || !fpage)
+ if (xa_is_value(folio) || !folio)
continue;
- if (!is_transparent_hugepage(fpage))
+ if (!folio_test_large(folio))
goto next;
total++;
- nr_pages = thp_nr_pages(fpage);
+ nr_pages = folio_nr_pages(folio);
- if (!trylock_page(fpage))
+ if (!folio_trylock(folio))
goto next;
- if (!split_huge_page(fpage))
+ if (!split_folio(folio))
split++;
- unlock_page(fpage);
+ folio_unlock(folio);
next:
- put_page(fpage);
+ folio_put(folio);
cond_resched();
}
--
2.35.1
next prev parent reply other threads:[~2022-10-19 18:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-19 18:33 [PATCH 0/4] Remove FGP_HEAD flag Matthew Wilcox (Oracle)
2022-10-19 18:33 ` Matthew Wilcox (Oracle) [this message]
2022-10-19 18:33 ` [PATCH 2/4] mm/swap: Convert find_get_incore_page to use folios Matthew Wilcox (Oracle)
2022-10-19 18:33 ` [PATCH 3/4] mm: Convert find_get_incore_page() to filemap_get_incore_folio() Matthew Wilcox (Oracle)
2022-10-19 18:33 ` [PATCH 4/4] mm: Remove FGP_HEAD Matthew Wilcox (Oracle)
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=20221019183332.2802139-2-willy@infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.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