Re: [PATCH] mm/page_io: use folios in sio_write_complete()

David CARLIER
2026-03-23T23:08:10Z

Hi Andrew,

Thanks for pointing that out. I'll park the folio conversion until
after -rc1.

Sashiko's observation is correct — sio_read_complete() undercounts
PSWPIN for large folios. sio->pages tracks bvec entries (folios), not
base pages. The bdev paths correctly use folio_nr_pages(folio) but the
sio path doesn't.

I'll send a fix replacing sio->pages with sio->len >> PAGE_SHIFT,
which gives the correct base page count since sio->len is accumulated
via folio_size(folio).

Cheers !

On Mon, 23 Mar 2026 at 22:54, Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Mon, 23 Mar 2026 17:04:49 +0000 David Carlier <devnexen@gmail.com> wrote:
>
> > Convert sio_write_complete() from legacy page APIs to folio equivalents,
> > matching the conversion already done for sio_read_complete() in commit
> > 6a8c068774ad ("mm/page_io: use a folio in sio_read_complete()").
> >
> > Replace set_page_dirty(), ClearPageReclaim() and end_page_writeback()
> > with folio_mark_dirty(), folio_clear_reclaim() and folio_end_writeback()
> > respectively, saving implicit calls to compound_head().
> >
> > Also replace page_swap_entry() with a direct folio->swap access since
> > bvec entries are always set via bvec_set_folio(), meaning bv_page is
> > always the head page.
> >
>
> This prompted AI review to look at sio_read_complete() and it didn't
> like what it saw. Can you please check
> https://sashiko.dev/#/patchset/20260323170449.26333-1-devnexen@gmail.com?
>
> Also, mm.git is (over)full. Can we please park the nice-to-have
> cleanups until after next -rc1?