Skip to content

mm, iomap, NFSD: stop uncached writes reading back shared pages

Mike Snitzer linux-fsdevel linux-mm linux-nfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v7 Latest5 patches 10 repliesIn review

Changes in v7 from the cover letter

- v6 1/6 dropped: Chuck applied it to cel/nfsd-testing as ad42983b887e.
- 1/5 to 4/5 (v6 2/6 to 5/6) are unchanged; 5/5 (v6 6/6) only differs in context, from its rebase.

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5mm: expose WB_DONTCACHE_DIRTY in bdi debugfs statsmm/backing-dev.c+11 -03 replies
2/5mm: add folio_mark_dropbehind() to mark a folio dropbehind and account itinclude/linux/pagemap.h mm/filemap.c+32 -02 replies
3/5mm, iomap: keep a partly covered page until an uncached write completes itfs/iomap/buffered-io.c include/linux/pagemap.h mm/filemap.c+34 -22 replies
4/5mm, iomap: let an uncached writer complete its shared pages itselffs/iomap/buffered-io.c fs/iomap/trace.h include/linux/fs.h +3 more+77 -32 replies
5/5NFSD: drop a shared boundary page only once both WRITEs have written itDocumentation/filesystems/nfs/nfsd-io-modes.rst fs/nfsd/vfs.c+104 -120 replies

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchJeff Layton
1/5R-b R-b
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH v7 0/5] mm, iomap, NFSD: stop uncached writes reading back shared pages

Hi,

Please consider this v7 for the v7.5 development cycle, so that it can go upstream in the v7.5 merge window.

An uncached (RWF_DONTCACHE) buffered write drops each page it writes once that page is written back. A page the write covers only partly is shared with the neighbouring write, and once the first of the two has been written back the second has to read it back from disk before it can write its part. 32 threads writing interleaved records to one file on XFS (emulated 4Kn NVMe, 4 KiB pages), before and after 3/5:

record pwritev2() flags 4 KiB device MiB/s
bytes reads per write

                                    before   after     before  after
  47008   RWF_DONTCACHE             0.97     0.000     831     2281
  47008   RWF_DONTCACHE|RWF_DSYNC   0.99     0.000     601     1227
  6000    RWF_DONTCACHE             0.97     0.000     121      488
  6000    RWF_DONTCACHE|RWF_DSYNC   0.99     0.000      90      206

3/5 has the page cache keep such a page for the write that completes it. 4/5 lets a writer that syncs its own write, as NFSD does for a stable WRITE, complete those pages itself once the sync is done. 5/5 is the NFSD change that uses it. 1/5 reports the DONTCACHE dirty count in the bdi debugfs stats, and 2/5 adds folio_mark_dropbehind(), which 3/5 and 4/5 use.

The prerequisite NFSD changes are staged in cel/nfsd-testing, through ad42983b887e ("NFSD: add tracing for how direct-mode READ and WRITE are serviced"), which was v6's 1/6. This series applies on top of it, and each patch builds with W=1 with no warnings.

1/5 to 4/5 are mm, with small iomap changes in 3/5 and 4/5, and are Cc'd to linux-mm and linux-fsdevel. If the mm and iomap maintainers are agreeable, their acks would let Chuck take the series through the nfsd tree.

Changes since v6:
- v6 1/6 dropped: Chuck applied it to cel/nfsd-testing as ad42983b887e.
- 1/5 to 4/5 (v6 2/6 to 5/6) are unchanged; 5/5 (v6 6/6) only differs in context, from its rebase.

v6: https://lore.kernel.org/linux-nfs/[email protected]/
v5: https://lore.kernel.org/linux-nfs/[email protected]/
v4: https://lore.kernel.org/linux-nfs/[email protected]/
v3: https://lore.kernel.org/linux-nfs/[email protected]/
v2: https://lore.kernel.org/linux-nfs/[email protected]/
v1: https://lore.kernel.org/linux-nfs/[email protected]/

Thanks,
Mike

Mike Snitzer (5):
mm: expose WB_DONTCACHE_DIRTY in bdi debugfs stats
mm: add folio_mark_dropbehind() to mark a folio dropbehind and account it mm, iomap: keep a partly covered page until an uncached write completes it mm, iomap: let an uncached writer complete its shared pages itself
NFSD: drop a shared boundary page only once both WRITEs have written it

 .../filesystems/nfs/nfsd-io-modes.rst         |  17 +++
 fs/iomap/buffered-io.c                        |  16 ++-
 fs/iomap/trace.h                              |   3 +-
 fs/nfsd/vfs.c                                 |  99 ++++++++++++++--
 include/linux/fs.h                            |   8 +-
 include/linux/iomap.h                         |   1 +
 include/linux/pagemap.h                       |  12 ++
 mm/backing-dev.c                              |  11 ++
 mm/filemap.c                                  | 106 +++++++++++++++++-
 9 files changed, 257 insertions(+), 16 deletions(-)
Signature · 1 line
2.52.0