From: Mike Snitzer <snitzer@kernel.org>
To: Matthew Wilcox <willy@infradead.org>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Cc: Chuck Lever <cel@kernel.org>, Jeff Layton <jlayton@kernel.org>,
linux-nfs@vger.kernel.org, NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
Jonathan Corbet <corbet@lwn.net>
Subject: [PATCH v10 0/7] mm, iomap, NFSD: stop uncached writes reading back shared pages
Date: Tue, 3 Nov 2026 16:17:47 -0500 [thread overview]
Message-ID: <20261103211754.35352-1-snitzer@kernel.org> (raw)
Hi,
An uncached (RWF_DONTCACHE) buffered write drops each folio it writes
once the folio is written back. A folio that the write covers only
partly is shared with the neighbouring write. If it is dropped before
the neighbour writes its part, the neighbour reads it back from disk
first. 32 threads writing interleaved records to one XFS file, 4 KiB
pages, before and after 5/7:
record pwritev2() flags 4 KiB device MiB/s
bytes reads per write
before after before after
47008 RWF_DONTCACHE 0.97 0.0005 831 2281
47008 RWF_DONTCACHE|RWF_DSYNC 0.99 0.0005 601 1227
6000 RWF_DONTCACHE 0.97 0.0001 121 488
6000 RWF_DONTCACHE|RWF_DSYNC 0.99 0.0002 90 206
The test program and script: https://lore.kernel.org/linux-nfs/atqJBS8MlYfeUU-t@kernel.org/
- 1/7 moves code into a helper, with no functional change.
- 2/7 fixes 88d6f128d06d ("mm: track DONTCACHE dirty pages per
bdi_writeback"), in v7.3: WB_DONTCACHE_DIRTY could drift.
- 3/7 reports WB_DONTCACHE_DIRTY in the bdi debugfs stats.
- 4/7 adds folio_mark_dropbehind() for a folio that is already dirty.
- 5/7 keeps a partly covered folio until the write that completes it.
- 6/7 lets a writer that syncs its own write complete those folios
itself, after the sync.
- 7/7 makes NFSD do that for the misaligned ends of a direct-mode WRITE.
Merging: Chuck suggested taking the series through the mm tree. 1/7 to
6/7 apply cleanly to each of these mm branches:
mm-unstable 0ea6dc8c4a21 ("fs/proc/task_mmu: fix lost maps entries above 2^63")
mm-new 74d73ffcffe0 ("riscv: mm: fix concurrency in mark_new_valid_map()")
mm-stable 6628e7d4c6b2 ("Linux 7.4-rc1")
7/7 needs the NFSD direct-mode changes that are in cel/nfsd-testing.
The whole series applies to cel/nfsd-testing at 693afd3ce9ae ("NFSD:
Defer the PUTFH export security flavor check"), where each patch builds
with W=1 with no warnings. So 7/7 could follow in the nfsd tree once
the mm part is merged.
Changes since v9, from Christoph's review:
- v9 1/6 is now two patches: 1/7 only moves the code, and 2/7 changes
it.
- Every commit message is rewritten to state the problem, the fix and
the result, without the earlier detail.
- The long code comments are shorter.
- Rebased on the current cel/nfsd-testing, which now has b16607436d31
("NFSD: cut a misaligned direct-mode WRITE at folio boundaries").
- Jeff's Reviewed-by of v9 is carried on every patch but 1/7, which is
new, because the code changed only in comments and in the split of v9
1/6.
The code is the same as in v9 apart from the comments, so the v9
results hold. Patches 2, 4, 5, 6 and 7 carry notes below the ---
line: questions from earlier reviews, and the code that answers each.
v9: https://lore.kernel.org/linux-nfs/20261024221152.6965-1-snitzer@kernel.org/
v8: https://lore.kernel.org/linux-nfs/20261023024548.71123-1-snitzer@kernel.org/
v7: https://lore.kernel.org/linux-nfs/20261020220346.28020-1-snitzer@kernel.org/
v6: https://lore.kernel.org/linux-nfs/atbfEbgMU6UGkn2X@kernel.org/
v5: https://lore.kernel.org/linux-nfs/20261019150725.1507-1-snitzer@kernel.org/
v4: https://lore.kernel.org/linux-nfs/20261015233309.42999-1-snitzer@kernel.org/
v3: https://lore.kernel.org/linux-nfs/20261001045502.48381-1-snitzer@kernel.org/
v2: https://lore.kernel.org/linux-nfs/20260929231329.22018-1-snitzer@kernel.org/
v1: https://lore.kernel.org/linux-nfs/20260929173423.16149-1-snitzer@kernel.org/
Thanks,
Mike
Mike Snitzer (7):
mm: move clearing the uncached flag of a found folio into a helper
mm: take a folio off WB_DONTCACHE_DIRTY only if it was counted there
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 | 30 ++-
fs/iomap/trace.h | 3 +-
fs/nfsd/vfs.c | 106 ++++++++-
include/linux/fs.h | 5 +-
include/linux/iomap.h | 1 +
include/linux/pagemap.h | 11 +
mm/backing-dev.c | 6 +
mm/filemap.c | 208 ++++++++++++++++--
9 files changed, 356 insertions(+), 31 deletions(-)
base-commit: 693afd3ce9ae5cddb7225ec87975e6ef1443e502
--
2.52.0
next reply other threads:[~2026-11-03 21:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 21:17 Mike Snitzer [this message]
2026-11-03 21:17 ` [PATCH v10 1/7] mm: move clearing the uncached flag of a found folio into a helper Mike Snitzer
2026-11-04 9:17 ` Christoph Hellwig
2026-11-03 21:17 ` [PATCH v10 2/7] mm: take a folio off WB_DONTCACHE_DIRTY only if it was counted there Mike Snitzer
2026-11-03 21:17 ` [PATCH v10 3/7] mm: expose WB_DONTCACHE_DIRTY in bdi debugfs stats Mike Snitzer
2026-11-03 21:17 ` [PATCH v10 4/7] mm: add folio_mark_dropbehind() to mark a folio dropbehind and account it Mike Snitzer
2026-11-03 21:17 ` [PATCH v10 5/7] mm, iomap: keep a partly covered page until an uncached write completes it Mike Snitzer
2026-11-03 21:17 ` [PATCH v10 6/7] mm, iomap: let an uncached writer complete its shared pages itself Mike Snitzer
2026-11-03 21:17 ` [PATCH v10 7/7] NFSD: drop a shared boundary page only once both WRITEs have written it Mike Snitzer
2026-11-04 9:15 ` Christoph Hellwig
2026-11-04 17:01 ` Mike Snitzer
2026-11-05 7:59 ` Christoph Hellwig
2026-11-05 13:33 ` Chuck Lever
2026-11-04 9:17 ` [PATCH v10 0/7] mm, iomap, NFSD: stop uncached writes reading back shared pages Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103211754.35352-1-snitzer@kernel.org \
--to=snitzer@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=axboe@kernel.dk \
--cc=cel@kernel.org \
--cc=corbet@lwn.net \
--cc=hch@lst.de \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox