Re: [PATCH 1/6] mm/page_io: convert write completion handlers to folios
"Lorenzo Stoakes (ARM)" <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.kernel.mm |
|---|---|
| Message-ID | <annIJC0TtWS74rAw@lucifer> |
On Thu, Aug 06, 2026 at 06:55:33PM -0400, Tal Zussman wrote: > Convert swap_write_end() and swap_fs_write_complete() to operate on > folios directly instead of going through the folio-compat page APIs. > This removes calls to end_page_writeback() and set_page_dirty(), and the > last caller of ClearPageReclaim(), saving two calls to compound_head() > per folio on the write error path. > > Signed-off-by: Tal Zussman <[email protected]> Very lovely, thanks! :) I see you remove PageReclaim in the subsequent commit which makes sense as a follow-up. Reviewed-by: Lorenzo Stoakes (ARM) <[email protected]> > --- > mm/page_io.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/mm/page_io.c b/mm/page_io.c > index e4fa7ffffe8b..43b4383a4729 100644 > --- a/mm/page_io.c > +++ b/mm/page_io.c > @@ -496,13 +496,13 @@ static void swap_write_end(struct swap_iocb *sio, bool failed) > int p; > > for (p = 0; p < sio->nr_bvecs; p++) { > - struct page *page = sio->bvecs[p].bv_page; > + struct folio *folio = bvec_folio(&sio->bvecs[p]); > > if (failed) { > - set_page_dirty(page); > - ClearPageReclaim(page); > + folio_mark_dirty(folio); > + folio_clear_reclaim(folio); > } > - end_page_writeback(page); > + folio_end_writeback(folio); > } > mempool_free(sio, sio_pool); > } > @@ -513,16 +513,16 @@ static void swap_fs_write_complete(struct kiocb *iocb, long ret) > bool failed = ret != sio->len; > > if (failed) { > - struct page *page = sio->bvecs[0].bv_page; > + struct folio *folio = bvec_folio(&sio->bvecs[0]); > > /* > * In the case of swap-over-nfs, this can be a temporary failure > * if the system has limited memory for allocating transmit > - * buffers. Mark the page dirty and avoid > + * buffers. Mark the folio dirty and avoid > * folio_rotate_reclaimable but rate-limit the messages. > */ > pr_err_ratelimited("Write error %ld on dio swapfile (%llu)\n", > - ret, swap_dev_pos(page_swap_entry(page))); > + ret, swap_dev_pos(folio->swap)); > } > > swap_write_end(sio, failed); > > -- > 2.39.5 > -- Cheers, Lorenzo