From: ZhangPeng <[email protected]>
This patch series converts several functions in page_io.c to use a
folio, which can remove several implicit calls to compound_head().
Changelog:
v3:
- introduce bio_first_folio_all(), rather than replacing
bio_first_page_all() per Matthew (patch 3)
- use a folio in __end_swap_bio_write() (patch 4)
- remove unneeded ifdefs per Matthew (patch 9)
v2:
- remove unneeded ClearPageUptodate() and SetPageError(), suggested by
Matthew Wilcox
- convert bio_first_page_all() to bio_first_folio_all()
- convert PageTransHuge to folio_test_pmd_mappable per Matthew Wilcox
ZhangPeng (10):
mm/page_io: remove unneeded ClearPageUptodate()
mm/page_io: remove unneeded SetPageError()
mm/page_io: introduce bio_first_folio_all()
mm/page_io: use a folio in __end_swap_bio_write()
mm/page_io: use a folio in __end_swap_bio_read()
mm/page_io: use a folio in sio_read_complete()
mm/page_io: use a folio in swap_writepage_bdev_sync()
mm/page_io: use a folio in swap_writepage_bdev_async()
mm/page_io: convert count_swpout_vm_event() to take in a folio
mm/page_io: convert bio_associate_blkg_from_page() to take in a folio
Documentation/block/biovecs.rst | 1 +
include/linux/bio.h | 5 +++
mm/page_io.c | 63 +++++++++++++++------------------
3 files changed, 35 insertions(+), 34 deletions(-)
--
2.25.1
From: ZhangPeng <[email protected]>
Saves one implicit call to compound_head().
Signed-off-by: ZhangPeng <[email protected]>
---
mm/page_io.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/page_io.c b/mm/page_io.c
index d9f5fa5b7281..3b97289153f9 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -57,16 +57,16 @@ static void end_swap_bio_write(struct bio *bio)
static void __end_swap_bio_read(struct bio *bio)
{
- struct page *page = bio_first_page_all(bio);
+ struct folio *folio = bio_first_folio_all(bio);
if (bio->bi_status) {
pr_alert_ratelimited("Read-error on swap-device (%u:%u:%llu)\n",
MAJOR(bio_dev(bio)), MINOR(bio_dev(bio)),
(unsigned long long)bio->bi_iter.bi_sector);
} else {
- SetPageUptodate(page);
+ folio_mark_uptodate(folio);
}
- unlock_page(page);
+ folio_unlock(folio);
}
static void end_swap_bio_read(struct bio *bio)
--
2.25.1
From: ZhangPeng <[email protected]>
Saves two implicit call to compound_head().
Signed-off-by: ZhangPeng <[email protected]>
---
mm/page_io.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/page_io.c b/mm/page_io.c
index 5ddb5d9c5013..d9f5fa5b7281 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -29,7 +29,7 @@
static void __end_swap_bio_write(struct bio *bio)
{
- struct page *page = bio_first_page_all(bio);
+ struct folio *folio = bio_first_folio_all(bio);
if (bio->bi_status) {
/*
@@ -40,13 +40,13 @@ static void __end_swap_bio_write(struct bio *bio)
*
* Also clear PG_reclaim to avoid folio_rotate_reclaimable()
*/
- set_page_dirty(page);
+ folio_mark_dirty(folio);
pr_alert_ratelimited("Write-error on swap-device (%u:%u:%llu)\n",
MAJOR(bio_dev(bio)), MINOR(bio_dev(bio)),
(unsigned long long)bio->bi_iter.bi_sector);
- ClearPageReclaim(page);
+ folio_clear_reclaim(folio);
}
- end_page_writeback(page);
+ folio_end_writeback(folio);
}
static void end_swap_bio_write(struct bio *bio)
--
2.25.1
From: ZhangPeng <[email protected]>
Saves one implicit call to compound_head().
Signed-off-by: ZhangPeng <[email protected]>
---
mm/page_io.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/mm/page_io.c b/mm/page_io.c
index 3b97289153f9..7e7a9f67b9ad 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -403,17 +403,17 @@ static void sio_read_complete(struct kiocb *iocb, long ret)
if (ret == sio->len) {
for (p = 0; p < sio->pages; p++) {
- struct page *page = sio->bvec[p].bv_page;
+ struct folio *folio = page_folio(sio->bvec[p].bv_page);
- SetPageUptodate(page);
- unlock_page(page);
+ folio_mark_uptodate(folio);
+ folio_unlock(folio);
}
count_vm_events(PSWPIN, sio->pages);
} else {
for (p = 0; p < sio->pages; p++) {
- struct page *page = sio->bvec[p].bv_page;
+ struct folio *folio = page_folio(sio->bvec[p].bv_page);
- unlock_page(page);
+ folio_unlock(folio);
}
pr_alert_ratelimited("Read-error on swap-device\n");
}
--
2.25.1