From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: David Howells <dhowells@redhat.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 4/6] filemap: Convert __readahead_batch() to use a folio
Date: Mon, 3 Mar 2025 17:53:14 +0000 [thread overview]
Message-ID: <20250303175317.3277891-5-willy@infradead.org> (raw)
In-Reply-To: <20250303175317.3277891-1-willy@infradead.org>
Extract folios from i_mapping, not pages. Removes a hidden call to
compound_head(), a use of thp_nr_pages() and an unnecessary assertion
that we didn't find a tail page in the page cache.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/pagemap.h | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index e51c0febd036..f4b875b561e5 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -1449,7 +1449,7 @@ static inline unsigned int __readahead_batch(struct readahead_control *rac,
{
unsigned int i = 0;
XA_STATE(xas, &rac->mapping->i_pages, 0);
- struct page *page;
+ struct folio *folio;
BUG_ON(rac->_batch_count > rac->_nr_pages);
rac->_nr_pages -= rac->_batch_count;
@@ -1458,13 +1458,12 @@ static inline unsigned int __readahead_batch(struct readahead_control *rac,
xas_set(&xas, rac->_index);
rcu_read_lock();
- xas_for_each(&xas, page, rac->_index + rac->_nr_pages - 1) {
- if (xas_retry(&xas, page))
+ xas_for_each(&xas, folio, rac->_index + rac->_nr_pages - 1) {
+ if (xas_retry(&xas, folio))
continue;
- VM_BUG_ON_PAGE(!PageLocked(page), page);
- VM_BUG_ON_PAGE(PageTail(page), page);
- array[i++] = page;
- rac->_batch_count += thp_nr_pages(page);
+ VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
+ array[i++] = folio_page(folio, 0);
+ rac->_batch_count += folio_nr_pages(folio);
if (i == array_sz)
break;
}
--
2.47.2
next prev parent reply other threads:[~2025-03-03 18:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-03 17:53 [PATCH 0/6] ITER_XARRAY cleanups and consequences Matthew Wilcox (Oracle)
2025-03-03 17:53 ` [PATCH 1/6] iov_iter: Convert iter_xarray_populate_pages() to use folios Matthew Wilcox (Oracle)
2025-03-03 17:53 ` [PATCH 2/6] iov_iter: Convert iov_iter_extract_xarray_pages() " Matthew Wilcox (Oracle)
2025-03-03 17:53 ` [PATCH 3/6] pagemap: Remove find_subpage() Matthew Wilcox (Oracle)
2025-03-03 17:53 ` Matthew Wilcox (Oracle) [this message]
2025-03-03 17:53 ` [PATCH 5/6] pagemap: Remove readahead_page_batch() Matthew Wilcox (Oracle)
2025-03-03 17:53 ` [PATCH 6/6] mm: Delete thp_nr_pages() 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=20250303175317.3277891-5-willy@infradead.org \
--to=willy@infradead.org \
--cc=dhowells@redhat.com \
--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