Skip to content

RFC Writeback handling of pinned pages

Jan Kara linux-block linux-fsdevel linux-mm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 20 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5mm: Do not reclaim private data from pinned pagemm/vmscan.c+10 -08 replies
2/5ext4: Drop workaround for mm reclaiming fs private page datafs/ext4/inode.c+0 -160 replies
3/5mm: Do not try to write pinned folio during memory cleaning writebackfs/9p/vfs_addr.c fs/afs/file.c fs/afs/write.c +26 more+73 -564 replies
4/5block: Add support for bouncing pinned pagesblock/blk.h block/bounce.c include/linux/blk_types.h +1 more+21 -78 replies
5/5iomap: Bounce pinned pages during writebackfs/iomap/buffered-io.c+8 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 0/5] Writeback handling of pinned pages

Hello,

since we are slowly getting into a state where folios used as buffers for [R]DMA are detectable by folio_maybe_dma_pinned(), I figured it is time we also address the original problems filesystems had with these pages [1] - namely that page/folio private data can get reclaimed from the page while it is being written to by the DMA and also that page contents can be modified while the page is under writeback.

This patch series is kind of an outline how the solution could look like (so far only compile tested). The first two patches deal with the reclaim of page private data for pinned pages. They are IMO no-brainers and actually deal with 99% of the observed issues so we might just separate them and merge them earlier. The remainder of the series deals with the concern that page contents can be modified while the page is being written back. What it implements is that instead we skip page cleaning writeback for pinned pages and if we cannot avoid writing the page (data integrity writeback), we bite the bullet and bounce the page.

Note that the conversion of clear_page_dirty_for_io() (and its folio variant) is kind of rough and providing wbc to the function only in the obvious cases - that will need a bit more work but OTOH functionally passing NULL just retains the old behavior + WARNs if we actually see pinned page in the writeback path.

Opinions?

Honza

[1] https://lore.kernel.org/linux-mm/[email protected]