Skip to contentSkip to conversation

mm: improve write performance with RWF_DONTCACHE

PATCH Superseded Jeff Layton 6 participants 19 messages Apr 26 – Apr 28

Subsystems (8)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Jeff Layton

author maintainer
#0 lore raw

v3 cover mm: improve write performance with RWF_DONTCACHE

This patch series attempts to improve write performance with RWF_DONTCACHE. The main justification and benchmarks for the series are in patch #2.

This version implements a scheme that Jan Kara and Christoph Hellwig suggested during review of the earlier series: after a DONTCACHE write, kick the flusher thread to do an amount of writeback proportional to the amount written, but don't target any particular inode or pages when doing writeback.

The second patch in the series has a summary of the benchmark results. This seems to work as well or better than the earlier approaches.

The benchmarks I used are in the last two patches. I'm not sure if we want to merge those into the tree as they are (mostly) AI slop. There is probably a better tool for this out there.

---
Changes in v3:
- Track dirty DONTCACHE pages in the VM
- Have flusher write back a proportional number of pages after DONTCACHE write
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- kick flusher thread instead of initiating writeback inline
- add mechanism to run 'perf lock' around the testcases
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Jeff Layton (4):
mm: add NR_DONTCACHE_DIRTY node page counter
mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking
testing: add nfsd-io-bench NFS server benchmark suite
testing: add dontcache-bench local filesystem benchmark suite

 fs/fs-writeback.c                                  |  60 +++
 include/linux/backing-dev-defs.h                   |   2 +
 include/linux/fs.h                                 |   6 +-
 include/linux/mmzone.h                             |   1 +
 include/trace/events/writeback.h                   |   3 +-
 mm/filemap.c                                       |   6 +-
 mm/page-writeback.c                                |   7 +
 mm/vmstat.c                                        |   1 +
 .../dontcache-bench/fio-jobs/lat-reader.fio        |  12 +
 .../dontcache-bench/fio-jobs/multi-write.fio       |   9 +
 .../dontcache-bench/fio-jobs/noisy-writer.fio      |  12 +
 .../testing/dontcache-bench/fio-jobs/rand-read.fio |  13 +
 .../dontcache-bench/fio-jobs/rand-write.fio        |  13 +
 .../testing/dontcache-bench/fio-jobs/seq-read.fio  |  13 +
 .../testing/dontcache-bench/fio-jobs/seq-write.fio |  13 +
 .../dontcache-bench/scripts/parse-results.sh       | 238 +++++++++
 .../dontcache-bench/scripts/run-benchmarks.sh      | 562 ++++++++++++++++++++
 .../testing/nfsd-io-bench/fio-jobs/lat-reader.fio  |  15 +
 .../testing/nfsd-io-bench/fio-jobs/multi-write.fio |  14 +
 .../nfsd-io-bench/fio-jobs/noisy-writer.fio        |  14 +
 tools/testing/nfsd-io-bench/fio-jobs/rand-read.fio |  15 +
 .../testing/nfsd-io-bench/fio-jobs/rand-write.fio  |  15 +
 tools/testing/nfsd-io-bench/fio-jobs/seq-read.fio  |  14 +
 tools/testing/nfsd-io-bench/fio-jobs/seq-write.fio |  14 +
 .../testing/nfsd-io-bench/scripts/parse-results.sh | 238 +++++++++
 .../nfsd-io-bench/scripts/run-benchmarks.sh        | 591 +++++++++++++++++++++
 .../testing/nfsd-io-bench/scripts/setup-server.sh  |  94 ++++
 27 files changed, 1989 insertions(+), 6 deletions(-)

---
base-commit: 27d128c1cff64c3b8012cc56dd5a1391bb4f1821
change-id: 20260401-dontcache-5811efd7eaf3

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
author maintainer
#1 lore raw

PATCH v3 1/4 mm: add NR_DONTCACHE_DIRTY node page counter

Add a per-node page counter that tracks the number of dirty pages with the dropbehind flag set (i.e., pages dirtied via RWF_DONTCACHE writes).

Increment the counter alongside NR_FILE_DIRTY in folio_account_dirtied() when the folio has the dropbehind flag set, and decrement it in folio_clear_dirty_for_io(), folio_account_cleaned(), and when a non-DONTCACHE access clears the dropbehind flag on a dirty folio.

The counter is visible via /proc/vmstat as "nr_dontcache_dirty" and will be used by the writeback flusher to determine how many pages to write back when expediting writeback for IOCB_DONTCACHE writes, without flushing the entire BDI's dirty pages.

Assisted-by Claude:claude-opus-4-6
---
 include/linux/mmzone.h | 1 +
 mm/filemap.c           | 6 +++++-
 mm/page-writeback.c    | 7 +++++++
 mm/vmstat.c            | 1 +
 4 files changed, 14 insertions(+), 1 deletion(-)
include/linux/mmzone.h +1 -0
index 9adb2ad21da5..ed9cc61c7627 100644
@@ -259,6 +259,7 @@ enum node_stat_item {
 			   only modified from process context */
 	NR_FILE_PAGES,
 	NR_FILE_DIRTY,
+	NR_DONTCACHE_DIRTY,
 	NR_WRITEBACK,
 	NR_SHMEM,		/* shmem pages (included tmpfs/GEM pages) */
 	NR_SHMEM_THPS,
mm/filemap.c +5 -1
index 4e636647100c..45089fde5150 100644
@@ -2052,8 +2052,12 @@ struct folio *__filemap_get_folio_mpol(struct address_space *mapping,
 	if (!folio)
 		return ERR_PTR(-ENOENT);
 	/* not an uncached lookup, clear uncached if set */
-	if (folio_test_dropbehind(folio) && !(fgp_flags & FGP_DONTCACHE))
+	if (folio_test_dropbehind(folio) && !(fgp_flags & FGP_DONTCACHE)) {
+		if (folio_test_dirty(folio))
+			lruvec_stat_mod_folio(folio, NR_DONTCACHE_DIRTY,
+					      -folio_nr_pages(folio));
 		folio_clear_dropbehind(folio);
+	}
 	return folio;
 }
 EXPORT_SYMBOL(__filemap_get_folio_mpol);
mm/page-writeback.c +7 -0
index 88cd53d4ba09..e1df93fb3e3b 100644
@@ -2630,6 +2630,8 @@ static void folio_account_dirtied(struct folio *folio,
 		wb = inode_to_wb(inode);
 
 		lruvec_stat_mod_folio(folio, NR_FILE_DIRTY, nr);
+		if (folio_test_dropbehind(folio))
+			lruvec_stat_mod_folio(folio, NR_DONTCACHE_DIRTY, nr);
 		__zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, nr);
 		__node_stat_mod_folio(folio, NR_DIRTIED, nr);
 		wb_stat_mod(wb, WB_RECLAIMABLE, nr);
@@ -2651,6 +2653,8 @@ void folio_account_cleaned(struct folio *folio, struct bdi_writeback *wb)
 	long nr = folio_nr_pages(folio);
 
 	lruvec_stat_mod_folio(folio, NR_FILE_DIRTY, -nr);
+	if (folio_test_dropbehind(folio))
+		lruvec_stat_mod_folio(folio, NR_DONTCACHE_DIRTY, -nr);
 	zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, -nr);
 	wb_stat_mod(wb, WB_RECLAIMABLE, -nr);
 	task_io_account_cancelled_write(nr * PAGE_SIZE);
@@ -2920,6 +2924,9 @@ bool folio_clear_dirty_for_io(struct folio *folio)
 		if (folio_test_clear_dirty(folio)) {
 			long nr = folio_nr_pages(folio);
 			lruvec_stat_mod_folio(folio, NR_FILE_DIRTY, -nr);
+			if (folio_test_dropbehind(folio))
+				lruvec_stat_mod_folio(folio,
+						NR_DONTCACHE_DIRTY, -nr);
 			zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, -nr);
 			wb_stat_mod(wb, WB_RECLAIMABLE, -nr);
 			ret = true;
mm/vmstat.c +1 -0
index f534972f517d..c3e5dfadb9a5 100644
@@ -1240,6 +1240,7 @@ const char * const vmstat_text[] = {
 	[I(NR_FILE_MAPPED)]			= "nr_mapped",
 	[I(NR_FILE_PAGES)]			= "nr_file_pages",
 	[I(NR_FILE_DIRTY)]			= "nr_dirty",
+	[I(NR_DONTCACHE_DIRTY)]			= "nr_dontcache_dirty",
 	[I(NR_WRITEBACK)]			= "nr_writeback",
 	[I(NR_SHMEM)]				= "nr_shmem",
 	[I(NR_SHMEM_THPS)]			= "nr_shmem_hugepages",
Signature · 1 line
2.53.0
author maintainer
#2 lore raw

PATCH v3 2/4 mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking

In reply to Jeff Layton

The IOCB_DONTCACHE writeback path in generic_write_sync() calls filemap_flush_range() on every write, submitting writeback inline in the writer's context. Perf lock contention profiling shows the performance problem is not lock contention but the writeback submission work itself — walking the page tree and submitting I/O blocks the writer for milliseconds, inflating p99.9 latency from 23ms (buffered) to 93ms (dontcache).

Replace the inline filemap_flush_range() call with a flusher kick that drains dirty pages in the background. This moves writeback submission completely off the writer's hot path.

To avoid flushing unrelated buffered dirty data, add a dedicated WB_start_dontcache bit and wb_check_start_dontcache() handler that uses the new NR_DONTCACHE_DIRTY counter to determine how many pages to write back. The flusher writes back that many pages from the oldest dirty inodes (not restricted to dontcache-specific inodes). This helps preserve I/O batching while limiting the scope of expedited writeback.

Like WB_start_all, the WB_start_dontcache bit coalesces multiple DONTCACHE writes into a single flusher wakeup without per-write allocations.

Also add WB_REASON_DONTCACHE as a new writeback reason for tracing visibility, and target the correct cgroup writeback domain via unlocked_inode_to_wb_begin().

dontcache-bench results on dual-socket Xeon Gold 6138 (80 CPUs, 256 GB RAM, Samsung MZ1LB1T9HALS 1.7 TB NVMe, local XFS, io_uring, file size ~503 GB, compared to a v6.19-ish baseline):

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              1449.8     1440.1      -0.7%
  dontcache             1347.9     1461.5      +8.4%
  direct                1450.0     1440.1      -0.7%

Single-client sequential write latency (us):
baseline patched change

  dontcache p50         3031.0    10551.3    +248.1%
  dontcache p99        74973.2    21626.9     -71.2%
  dontcache p99.9      85459.0    23199.7     -72.9%

Single-client random write (MB/s):
baseline patched change
dontcache 284.2 295.4 +3.9%

Single-client random write p99.9 latency (us):
baseline patched change
dontcache 2277.4 872.4 -61.7%

Multi-writer aggregate throughput (MB/s):

                       baseline    patched     change
  buffered              1619.5     1611.2      -0.5%
  dontcache             1281.1     1629.4     +27.2%
  direct                1545.4     1609.4      +4.1%

Mixed-mode noisy neighbor (dontcache writer + buffered readers):
baseline patched change
writer (MB/s) 1297.6 1471.1 +13.4%
readers avg (MB/s) 855.0 462.4 -45.9%

nfsd-io-bench results on same hardware (XFS on NVMe, NFSv3 via fio NFS engine with libnfs, 1024 NFSD threads, pool_mode=pernode, file size ~502 GB, compared to v6.19-ish baseline):

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              4844.2     4653.4      -3.9%
  dontcache             3028.3     3723.1     +22.9%

direct 957.6 987.8 +3.2%

Single-client sequential write p99.9 latency (us):
baseline patched change
dontcache 759169.0 175112.2 -76.9%

Single-client random write (MB/s):
baseline patched change
dontcache 590.0 1561.0 +164.6%

Multi-writer aggregate throughput (MB/s):

                       baseline    patched     change
  buffered              9636.3     9422.9      -2.2%
  dontcache             1894.9     9442.6    +398.3%

direct 809.6 975.1 +20.4%

Noisy neighbor (dontcache writer + random readers):
baseline patched change
writer (MB/s) 1854.5 4063.6 +119.1%
readers avg (MB/s) 131.2 101.6 -22.5%

The NFS results show even larger improvements than the local benchmarks. Multi-writer dontcache throughput improves nearly 5x, matching buffered I/O. Dirty page footprint drops 85-95% in sequential workloads vs. buffered.

Assisted-by Claude:claude-opus-4-6
---
 fs/fs-writeback.c                | 60 ++++++++++++++++++++++++++++++++++++++++
 include/linux/backing-dev-defs.h |  2 ++
 include/linux/fs.h               |  6 ++--
 include/trace/events/writeback.h |  3 +-
 4 files changed, 66 insertions(+), 5 deletions(-)
fs/fs-writeback.c +60 -0
index a65694cbfe68..377767db48f7 100644
@@ -1334,6 +1334,18 @@ static void wb_start_writeback(struct bdi_writeback *wb, enum wb_reason reason)
 	wb_wakeup(wb);
 }
 
+static void wb_start_dontcache_writeback(struct bdi_writeback *wb)
+{
+	if (!wb_has_dirty_io(wb))
+		return;
+
+	if (test_bit(WB_start_dontcache, &wb->state) ||
+	    test_and_set_bit(WB_start_dontcache, &wb->state))
+		return;
+
+	wb_wakeup(wb);
+}
+
 /**
  * wb_start_background_writeback - start background writeback
  * @wb: bdi_writback to write from
@@ -2373,6 +2385,28 @@ static long wb_check_start_all(struct bdi_writeback *wb)
 	return nr_pages;
 }
 
+static long wb_check_start_dontcache(struct bdi_writeback *wb)
+{
+	long nr_pages;
+
+	if (!test_bit(WB_start_dontcache, &wb->state))
+		return 0;
+
+	nr_pages = global_node_page_state(NR_DONTCACHE_DIRTY);
+	if (nr_pages) {
+		struct wb_writeback_work work = {
+			.nr_pages	= wb_split_bdi_pages(wb, nr_pages),
+			.sync_mode	= WB_SYNC_NONE,
+			.range_cyclic	= 1,
+			.reason		= WB_REASON_DONTCACHE,
+		};
+
+		nr_pages = wb_writeback(wb, &work);
+	}
+
+	clear_bit(WB_start_dontcache, &wb->state);
+	return nr_pages;
+}
 
 /*
  * Retrieve work items and do the writeback they describe
@@ -2394,6 +2428,11 @@ static long wb_do_writeback(struct bdi_writeback *wb)
 	 */
 	wrote += wb_check_start_all(wb);
 
+	/*
+	 * Check for dontcache writeback request
+	 */
+	wrote += wb_check_start_dontcache(wb);
+
 	/*
 	 * Check for periodic writeback, kupdated() style
 	 */
@@ -2468,6 +2507,27 @@ void wakeup_flusher_threads_bdi(struct backing_dev_info *bdi,
 	rcu_read_unlock();
 }
 
+/**
+ * filemap_dontcache_kick_writeback - kick flusher for IOCB_DONTCACHE writes
+ * @mapping:	address_space that was just written to
+ *
+ * Kick the writeback flusher thread to expedite writeback of dontcache
+ * dirty pages.  Uses a dedicated WB_start_dontcache bit so that only
+ * pages tracked by NR_DONTCACHE_DIRTY are written back, rather than
+ * flushing the entire BDI's dirty pages.
+ */
+void filemap_dontcache_kick_writeback(struct address_space *mapping)
+{
+	struct inode *inode = mapping->host;
+	struct bdi_writeback *wb;
+	struct wb_lock_cookie cookie = {};
+
+	wb = unlocked_inode_to_wb_begin(inode, &cookie);
+	wb_start_dontcache_writeback(wb);
+	unlocked_inode_to_wb_end(inode, &cookie);
+}
+EXPORT_SYMBOL_GPL(filemap_dontcache_kick_writeback);
+
 /*
  * Wakeup the flusher threads to start writeback of all currently dirty pages
  */
include/linux/backing-dev-defs.h +2 -0
index a06b93446d10..74f8a9977f5d 100644
@@ -26,6 +26,7 @@ enum wb_state {
 	WB_writeback_running,	/* Writeback is in progress */
 	WB_has_dirty_io,	/* Dirty inodes on ->b_{dirty|io|more_io} */
 	WB_start_all,		/* nr_pages == 0 (all) work pending */
+	WB_start_dontcache,	/* dontcache writeback pending */
 };
 
 enum wb_stat_item {
@@ -55,6 +56,7 @@ enum wb_reason {
 	 */
 	WB_REASON_FORKER_THREAD,
 	WB_REASON_FOREIGN_FLUSH,
+	WB_REASON_DONTCACHE,
 
 	WB_REASON_MAX,
 };
include/linux/fs.h +2 -4
index 11559c513dfb..df72b42a9e9b 100644
@@ -2624,6 +2624,7 @@ extern int __must_check file_write_and_wait_range(struct file *file,
 						loff_t start, loff_t end);
 int filemap_flush_range(struct address_space *mapping, loff_t start,
 		loff_t end);
+void filemap_dontcache_kick_writeback(struct address_space *mapping);
 
 static inline int file_write_and_wait(struct file *file)
 {
@@ -2657,10 +2658,7 @@ static inline ssize_t generic_write_sync(struct kiocb *iocb, ssize_t count)
 		if (ret)
 			return ret;
 	} else if (iocb->ki_flags & IOCB_DONTCACHE) {
-		struct address_space *mapping = iocb->ki_filp->f_mapping;
-
-		filemap_flush_range(mapping, iocb->ki_pos - count,
-				iocb->ki_pos - 1);
+		filemap_dontcache_kick_writeback(iocb->ki_filp->f_mapping);
 	}
 
 	return count;
include/trace/events/writeback.h +2 -1
index bdac0d685a98..13ee076ccd16 100644
@@ -44,7 +44,8 @@
 	EM( WB_REASON_PERIODIC,			"periodic")		\
 	EM( WB_REASON_FS_FREE_SPACE,		"fs_free_space")	\
 	EM( WB_REASON_FORKER_THREAD,		"forker_thread")	\
-	EMe(WB_REASON_FOREIGN_FLUSH,		"foreign_flush")
+	EM( WB_REASON_FOREIGN_FLUSH,		"foreign_flush")	\
+	EMe(WB_REASON_DONTCACHE,		"dontcache")
 
 WB_WORK_REASON
 
Signature · 1 line
2.53.0
maintainer
#3 lore raw

Re: [PATCH v3 2/4] mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking

Naive questions...

Quoted 7 lines · On Sun, 26 Apr 2026 07:56:08 -0400 Jeff Layton <[email protected]> wrote:

The IOCB_DONTCACHE writeback path in generic_write_sync() calls filemap_flush_range() on every write, submitting writeback inline in the writer's context. Perf lock contention profiling shows the performance problem is not lock contention but the writeback submission work itself — walking the page tree and submitting I/O blocks the writer for milliseconds, inflating p99.9 latency from 23ms (buffered) to 93ms (dontcache).

So in the current case, when generic_write_sync() returns, all that memory is written back and clean&reclaimable (or freed?), yes?

Quoted 3 lines

Replace the inline filemap_flush_range() call with a flusher kick that drains dirty pages in the background. This moves writeback submission completely off the writer's hot path.

Whereas after this change, that pagecache is probably still dirty, unreclaimable, waiting for the flusher to do its thing?

So is there potential that the system will get all gummed up with dirty, to-be-written-soon pagecache? Is there something which limits this buildup?

Quoted 32 lines

...

dontcache-bench results on dual-socket Xeon Gold 6138 (80 CPUs, 256 GB RAM, Samsung MZ1LB1T9HALS 1.7 TB NVMe, local XFS, io_uring, file size ~503 GB, compared to a v6.19-ish baseline):

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              1449.8     1440.1      -0.7%
  dontcache             1347.9     1461.5      +8.4%
  direct                1450.0     1440.1      -0.7%

Single-client sequential write latency (us):
baseline patched change

  dontcache p50         3031.0    10551.3    +248.1%
  dontcache p99        74973.2    21626.9     -71.2%
  dontcache p99.9      85459.0    23199.7     -72.9%

Single-client random write (MB/s):
baseline patched change
dontcache 284.2 295.4 +3.9%

Single-client random write p99.9 latency (us):
baseline patched change
dontcache 2277.4 872.4 -61.7%

Multi-writer aggregate throughput (MB/s):

                       baseline    patched     change
  buffered              1619.5     1611.2      -0.5%
  dontcache             1281.1     1629.4     +27.2%
  direct                1545.4     1609.4      +4.1%
Quoted 4 lines

Mixed-mode noisy neighbor (dontcache writer + buffered readers):
baseline patched change
writer (MB/s) 1297.6 1471.1 +13.4%
readers avg (MB/s) 855.0 462.4 -45.9%

These results look ambiguous. Sometimes better, sometimes worse?

Quoted 22 lines

nfsd-io-bench results on same hardware (XFS on NVMe, NFSv3 via fio NFS engine with libnfs, 1024 NFSD threads, pool_mode=pernode, file size ~502 GB, compared to v6.19-ish baseline):

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              4844.2     4653.4      -3.9%
  dontcache             3028.3     3723.1     +22.9%

direct 957.6 987.8 +3.2%

Single-client sequential write p99.9 latency (us):
baseline patched change
dontcache 759169.0 175112.2 -76.9%

Single-client random write (MB/s):
baseline patched change
dontcache 590.0 1561.0 +164.6%

Multi-writer aggregate throughput (MB/s):

                       baseline    patched     change
  buffered              9636.3     9422.9      -2.2%
  dontcache             1894.9     9442.6    +398.3%
Quoted 6 lines

direct 809.6 975.1 +20.4%

Noisy neighbor (dontcache writer + random readers):
baseline patched change
writer (MB/s) 1854.5 4063.6 +119.1%
readers avg (MB/s) 131.2 101.6 -22.5%

Ditto but less so.

Quoted 4 lines

The NFS results show even larger improvements than the local benchmarks. Multi-writer dontcache throughput improves nearly 5x, matching buffered I/O. Dirty page footprint drops 85-95% in sequential workloads vs. buffered.

It sounds that you like the results, so OK ;)

author maintainer
#4 lore raw

Re: [PATCH v3 2/4] mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking

Quoted 12 lines · Andrew Morton

Naive questions...

Quoted 7 lines · On Sun, 26 Apr 2026 07:56:08 -0400 Jeff Layton <[email protected]> wrote:

The IOCB_DONTCACHE writeback path in generic_write_sync() calls filemap_flush_range() on every write, submitting writeback inline in the writer's context. Perf lock contention profiling shows the performance problem is not lock contention but the writeback submission work itself — walking the page tree and submitting I/O blocks the writer for milliseconds, inflating p99.9 latency from 23ms (buffered) to 93ms (dontcache).

Quoted 3 lines

So in the current case, when generic_write_sync() returns, all that memory is written back and clean&reclaimable (or freed?), yes?

No. Before returning, it submits the I/Os for the portion that it wrote rather than leaving it to the flusher to take care of things, but it doesn't wait for the I/Os to complete.

Quoted 7 lines
Quoted 3 lines

Replace the inline filemap_flush_range() call with a flusher kick that drains dirty pages in the background. This moves writeback submission completely off the writer's hot path.

Whereas after this change, that pagecache is probably still dirty, unreclaimable, waiting for the flusher to do its thing?

Correct, but that's sort of the case today too since DONTCACHE I/Os don't wait for the completion. With this change we're just deferring the I/O submission to the flusher thread (which should hopefully soon wake and take care of business). If the flusher thread can't keep up, then eventually balance_dirty_pages() will kick in and start slowing things down.

Quoted 4 lines

So is there potential that the system will get all gummed up with dirty, to-be-written-soon pagecache? Is there something which limits this buildup?

Today in this situation, the writers are limited by the backing device throughput. Once the I/O submission queues are full, then the DONTCACHE writers end up stacking up on those. With this change, the writers will be more limited by traditional VM limits in this situation.

In the test runs I did, the peak pagecache with DONTCACHE writes was higher than with the unpatched version but still considerably less than with normal buffered I/O. That's the cost of deferring the I/O submission to the flusher.

One thing we could consider is going back to submitting the writes inline when the number of dirty pages is high. But, that could have a detrimental effect on performance too.

Quoted 76 lines
Quoted 32 lines

...

dontcache-bench results on dual-socket Xeon Gold 6138 (80 CPUs, 256 GB RAM, Samsung MZ1LB1T9HALS 1.7 TB NVMe, local XFS, io_uring, file size ~503 GB, compared to a v6.19-ish baseline):

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              1449.8     1440.1      -0.7%
  dontcache             1347.9     1461.5      +8.4%
  direct                1450.0     1440.1      -0.7%

Single-client sequential write latency (us):
baseline patched change

  dontcache p50         3031.0    10551.3    +248.1%
  dontcache p99        74973.2    21626.9     -71.2%
  dontcache p99.9      85459.0    23199.7     -72.9%

Single-client random write (MB/s):
baseline patched change
dontcache 284.2 295.4 +3.9%

Single-client random write p99.9 latency (us):
baseline patched change
dontcache 2277.4 872.4 -61.7%

Multi-writer aggregate throughput (MB/s):

                       baseline    patched     change
  buffered              1619.5     1611.2      -0.5%
  dontcache             1281.1     1629.4     +27.2%
  direct                1545.4     1609.4      +4.1%
Quoted 4 lines

Mixed-mode noisy neighbor (dontcache writer + buffered readers):
baseline patched change
writer (MB/s) 1297.6 1471.1 +13.4%
readers avg (MB/s) 855.0 462.4 -45.9%

These results look ambiguous. Sometimes better, sometimes worse?

Quoted 22 lines

nfsd-io-bench results on same hardware (XFS on NVMe, NFSv3 via fio NFS engine with libnfs, 1024 NFSD threads, pool_mode=pernode, file size ~502 GB, compared to v6.19-ish baseline):

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              4844.2     4653.4      -3.9%
  dontcache             3028.3     3723.1     +22.9%

direct 957.6 987.8 +3.2%

Single-client sequential write p99.9 latency (us):
baseline patched change
dontcache 759169.0 175112.2 -76.9%

Single-client random write (MB/s):
baseline patched change
dontcache 590.0 1561.0 +164.6%

Multi-writer aggregate throughput (MB/s):

                       baseline    patched     change
  buffered              9636.3     9422.9      -2.2%
  dontcache             1894.9     9442.6    +398.3%
Quoted 6 lines

direct 809.6 975.1 +20.4%

Noisy neighbor (dontcache writer + random readers):
baseline patched change
writer (MB/s) 1854.5 4063.6 +119.1%
readers avg (MB/s) 131.2 101.6 -22.5%

Ditto but less so.

Quoted 4 lines

The NFS results show even larger improvements than the local benchmarks. Multi-writer dontcache throughput improves nearly 5x, matching buffered I/O. Dirty page footprint drops 85-95% in sequential workloads vs. buffered.

It sounds that you like the results, so OK ;)

Signature · 1 line
Jeff Layton <[email protected]>
author maintainer
#5 lore raw

Re: [PATCH v3 2/4] mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking

In reply to Andrew Morton
Quoted 58 lines · Andrew Morton

Naive questions...

Quoted 7 lines · On Sun, 26 Apr 2026 07:56:08 -0400 Jeff Layton <[email protected]> wrote:

The IOCB_DONTCACHE writeback path in generic_write_sync() calls filemap_flush_range() on every write, submitting writeback inline in the writer's context. Perf lock contention profiling shows the performance problem is not lock contention but the writeback submission work itself — walking the page tree and submitting I/O blocks the writer for milliseconds, inflating p99.9 latency from 23ms (buffered) to 93ms (dontcache).

So in the current case, when generic_write_sync() returns, all that memory is written back and clean&reclaimable (or freed?), yes?

Quoted 3 lines

Replace the inline filemap_flush_range() call with a flusher kick that drains dirty pages in the background. This moves writeback submission completely off the writer's hot path.

Whereas after this change, that pagecache is probably still dirty, unreclaimable, waiting for the flusher to do its thing?

So is there potential that the system will get all gummed up with dirty, to-be-written-soon pagecache? Is there something which limits this buildup?

Quoted 32 lines

...

dontcache-bench results on dual-socket Xeon Gold 6138 (80 CPUs, 256 GB RAM, Samsung MZ1LB1T9HALS 1.7 TB NVMe, local XFS, io_uring, file size ~503 GB, compared to a v6.19-ish baseline):

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              1449.8     1440.1      -0.7%
  dontcache             1347.9     1461.5      +8.4%
  direct                1450.0     1440.1      -0.7%

Single-client sequential write latency (us):
baseline patched change

  dontcache p50         3031.0    10551.3    +248.1%
  dontcache p99        74973.2    21626.9     -71.2%
  dontcache p99.9      85459.0    23199.7     -72.9%

Single-client random write (MB/s):
baseline patched change
dontcache 284.2 295.4 +3.9%

Single-client random write p99.9 latency (us):
baseline patched change
dontcache 2277.4 872.4 -61.7%

Multi-writer aggregate throughput (MB/s):

                       baseline    patched     change
  buffered              1619.5     1611.2      -0.5%
  dontcache             1281.1     1629.4     +27.2%
  direct                1545.4     1609.4      +4.1%
Quoted 7 lines
Quoted 4 lines

Mixed-mode noisy neighbor (dontcache writer + buffered readers):
baseline patched change
writer (MB/s) 1297.6 1471.1 +13.4%
readers avg (MB/s) 855.0 462.4 -45.9%

These results look ambiguous. Sometimes better, sometimes worse?

Forgot to comment on this part earlier...

This is the "mixed-mode" (dontcache writes + buffered reads). I played with a bunch of different settings under nfsd, and those settings turned out to perform the best with this benchmark.

I suspect what's happening is that the increase in write throughput from writing via the flusher thread is crowding out reads. So, read throughput suffers in this test from that. There are a number of ways we could probably make that more fair.

Quoted 24 lines
Quoted 24 lines

nfsd-io-bench results on same hardware (XFS on NVMe, NFSv3 via fio NFS engine with libnfs, 1024 NFSD threads, pool_mode=pernode, file size ~502 GB, compared to v6.19-ish baseline):

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              4844.2     4653.4      -3.9%
  dontcache             3028.3     3723.1     +22.9%

direct 957.6 987.8 +3.2%

Single-client sequential write p99.9 latency (us):
baseline patched change
dontcache 759169.0 175112.2 -76.9%

Single-client random write (MB/s):
baseline patched change
dontcache 590.0 1561.0 +164.6%

Multi-writer aggregate throughput (MB/s):

                       baseline    patched     change
  buffered              9636.3     9422.9      -2.2%
  dontcache             1894.9     9442.6    +398.3%

direct 809.6 975.1 +20.4%

Quoted 7 lines
Quoted 4 lines

Noisy neighbor (dontcache writer + random readers):
baseline patched change
writer (MB/s) 1854.5 4063.6 +119.1%
readers avg (MB/s) 131.2 101.6 -22.5%

Ditto but less so.

Same reason for the drop, I think.

Quoted 6 lines
Quoted 4 lines

The NFS results show even larger improvements than the local benchmarks. Multi-writer dontcache throughput improves nearly 5x, matching buffered I/O. Dirty page footprint drops 85-95% in sequential workloads vs. buffered.

It sounds that you like the results, so OK ;)

I think it's a win overall. As with anything writeback-related, it's a game of tradeoffs. The good news is that DONTCACHE is still fairly new and not many applications are using it yet, so the blast radius from any change here should be rather small.

As a side note: I've long thought that we in general wait too long to kick off writeback with normal buffered I/O, particularly with modern memory sizes. DONTCACHE gives us a place to experiment with this scheme, but we may want to think about kicking off writeback earlier in the normal buffered case too.

Signature · 1 line
Jeff Layton <[email protected]>
maintainer
#6 lore raw

Re: [PATCH v3 2/4] mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking

In reply to Jeff Layton
Quoted 4 lines · Jeff Layton

Mixed-mode noisy neighbor (dontcache writer + buffered readers):
baseline patched change
writer (MB/s) 1297.6 1471.1 +13.4%
readers avg (MB/s) 855.0 462.4 -45.9%

hm. This wasn't what I thought of when I thought of "noisy neighbour". I'd have process A doing DONTCACHE writes to file A and process B doing normal buffered writes to file B.

author maintainer
#7 lore raw

Re: [PATCH v3 2/4] mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking

Quoted 9 lines · Matthew Wilcox
Quoted 4 lines · Jeff Layton

Mixed-mode noisy neighbor (dontcache writer + buffered readers):
baseline patched change
writer (MB/s) 1297.6 1471.1 +13.4%
readers avg (MB/s) 855.0 462.4 -45.9%

hm. This wasn't what I thought of when I thought of "noisy neighbour". I'd have process A doing DONTCACHE writes to file A and process B doing normal buffered writes to file B.

Originally, I was benchmarking this via nfsd and only later did I add the suite for local benchmarks. With nfsd, setting the iomode affects all reads or writes.

So initially, I had it testing them with both reads and writes set to the same setting, but then later I decided to play with different modes for reads and writes. The best performing one was buffered reads + dontcache writes. It's possible a mix of different modes will be better on a local fs.

I can't easily do a benchmark like you're suggesting with nfsd, but it should be possible on a local benchmark. I'll see what I can come up with.

Thanks,

Signature · 1 line
Jeff Layton <[email protected]>
#8 lore raw

Re: [PATCH v3 2/4] mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking

In reply to Jeff Layton
Quoted 12 lines · Jeff Layton

The IOCB_DONTCACHE writeback path in generic_write_sync() calls filemap_flush_range() on every write, submitting writeback inline in the writer's context. Perf lock contention profiling shows the performance problem is not lock contention but the writeback submission work itself — walking the page tree and submitting I/O blocks the writer for milliseconds, inflating p99.9 latency from 23ms (buffered) to 93ms (dontcache).

Replace the inline filemap_flush_range() call with a flusher kick that drains dirty pages in the background. This moves writeback submission completely off the writer's hot path.

Quoted 7 lines

To avoid flushing unrelated buffered dirty data, add a dedicated WB_start_dontcache bit and wb_check_start_dontcache() handler that uses the new NR_DONTCACHE_DIRTY counter to determine how many pages to write back. The flusher writes back that many pages from the oldest dirty inodes (not restricted to dontcache-specific inodes). This helps preserve I/O batching while limiting the scope of expedited writeback.

Yup, so, we wakeup the writeback flusher, which will write those many "number" of dirty pages. Those dirty pages written by writeback, can be of any type though, can be DONTCACHE or normal (non-dontcache) dirty pages. IIUC, writeback doesn't distinguish between them while writing.

IMO, what we could also include in the commit msg is why is this above approach taken? IIUC, that is because, by writing NR_DONTCACHE_DIRTY pages, it still reduces the page cache pressure and still reduces the amount of work that the reclaim has to do, even though some of those pages maybe non-dontcache pages, in case if there was a parallel buffered write in the system.

Also should the following change be documented somewhere? Like in Man page maybe? i.e.
Earlier RWF_DONTCACHE writes made sure that those dirty pages are immediately submitted for writeback and completion would release those pages. But now, in certain cases when there is a mixed buffered write in the system, those dontcache dirty pages might be written back after a delay (whenever the next time writeback kicks in).
However for RWF_DONTCACHE reads, it should not affect anything.

Quoted 4 lines

Like WB_start_all, the WB_start_dontcache bit coalesces multiple DONTCACHE writes into a single flusher wakeup without per-write allocations.

Quoted 8 lines

Also add WB_REASON_DONTCACHE as a new writeback reason for tracing visibility, and target the correct cgroup writeback domain via unlocked_inode_to_wb_begin().

dontcache-bench results on dual-socket Xeon Gold 6138 (80 CPUs, 256 GB RAM, Samsung MZ1LB1T9HALS 1.7 TB NVMe, local XFS, io_uring, file size ~503 GB, compared to a v6.19-ish baseline):

Can we please also test parallel buffered writes and dontcache writes? Since this patch series definitely affects that.

BTW - adding these numbers in the commit msg itself is much helpful.

Quoted 16 lines

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              1449.8     1440.1      -0.7%
  dontcache             1347.9     1461.5      +8.4%
  direct                1450.0     1440.1      -0.7%

Single-client sequential write latency (us):
baseline patched change

  dontcache p50         3031.0    10551.3    +248.1%
  dontcache p99        74973.2    21626.9     -71.2%
  dontcache p99.9      85459.0    23199.7     -72.9%

Single-client random write (MB/s):
baseline patched change
dontcache 284.2 295.4 +3.9%

Quoted 5 lines

Single-client random write p99.9 latency (us):
baseline patched change
dontcache 2277.4 872.4 -61.7%

Multi-writer aggregate throughput (MB/s):

Can you please help describe this test scenario if possible.. In above you mentioned we are writing file_size as 2x RAM_SIZE. But your multi-client tests says something else..

local num_clients=4
+ mem_kb=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
+ client_size="$(( mem_kb / 1024 / num_clients ))M"

Also the multi-writer case is spawning parallel fio jobs, and then parsing and aggregating the bandwidth results instead of using fio to spawn multiple parallel threads... which is ok, but a bit wierd. Why not let fio do the aggregate bandwidth, and latency calculation instead?

Quoted 39 lines
                       baseline    patched     change
  buffered              1619.5     1611.2      -0.5%
  dontcache             1281.1     1629.4     +27.2%
  direct                1545.4     1609.4      +4.1%

Mixed-mode noisy neighbor (dontcache writer + buffered readers):
baseline patched change
writer (MB/s) 1297.6 1471.1 +13.4%
readers avg (MB/s) 855.0 462.4 -45.9%

nfsd-io-bench results on same hardware (XFS on NVMe, NFSv3 via fio NFS engine with libnfs, 1024 NFSD threads, pool_mode=pernode, file size ~502 GB, compared to v6.19-ish baseline):

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              4844.2     4653.4      -3.9%
  dontcache             3028.3     3723.1     +22.9%

direct 957.6 987.8 +3.2%

Single-client sequential write p99.9 latency (us):
baseline patched change
dontcache 759169.0 175112.2 -76.9%

Single-client random write (MB/s):
baseline patched change
dontcache 590.0 1561.0 +164.6%

Multi-writer aggregate throughput (MB/s):

                       baseline    patched     change
  buffered              9636.3     9422.9      -2.2%
  dontcache             1894.9     9442.6    +398.3%

direct 809.6 975.1 +20.4%

Noisy neighbor (dontcache writer + random readers):
baseline patched change
writer (MB/s) 1854.5 4063.6 +119.1%
readers avg (MB/s) 131.2 101.6 -22.5%

Quoted 5 lines

The NFS results show even larger improvements than the local benchmarks. Multi-writer dontcache throughput improves nearly 5x, matching buffered I/O. Dirty page footprint drops 85-95% in sequential workloads vs. buffered.

Nice :)
Some explaination here of why 5x improvement with NFS compared to local filesystems please?
(I am not much aware of NFS side, but a possible reasoning would help)

-ritesh

author maintainer
#9 lore raw

Re: [PATCH v3 2/4] mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking

Quoted 22 lines · Ritesh Harjani
Quoted 12 lines · Jeff Layton

The IOCB_DONTCACHE writeback path in generic_write_sync() calls filemap_flush_range() on every write, submitting writeback inline in the writer's context. Perf lock contention profiling shows the performance problem is not lock contention but the writeback submission work itself — walking the page tree and submitting I/O blocks the writer for milliseconds, inflating p99.9 latency from 23ms (buffered) to 93ms (dontcache).

Replace the inline filemap_flush_range() call with a flusher kick that drains dirty pages in the background. This moves writeback submission completely off the writer's hot path.

Quoted 7 lines

To avoid flushing unrelated buffered dirty data, add a dedicated WB_start_dontcache bit and wb_check_start_dontcache() handler that uses the new NR_DONTCACHE_DIRTY counter to determine how many pages to write back. The flusher writes back that many pages from the oldest dirty inodes (not restricted to dontcache-specific inodes). This helps preserve I/O batching while limiting the scope of expedited writeback.

Quoted 5 lines

Yup, so, we wakeup the writeback flusher, which will write those many "number" of dirty pages. Those dirty pages written by writeback, can be of any type though, can be DONTCACHE or normal (non-dontcache) dirty pages. IIUC, writeback doesn't distinguish between them while writing.

Correct. This was the approach that Jan and HCH suggested in the responses to the last posting.

Quoted 8 lines

IMO, what we could also include in the commit msg is why is this above approach taken? IIUC, that is because, by writing NR_DONTCACHE_DIRTY pages, it still reduces the page cache pressure and still reduces the amount of work that the reclaim has to do, even though some of those pages maybe non-dontcache pages, in case if there was a parallel buffered write in the system.

Good suggestion. I'll add that.

Quoted 10 lines

Also should the following change be documented somewhere? Like in Man page maybe? i.e.
Earlier RWF_DONTCACHE writes made sure that those dirty pages are immediately submitted for writeback and completion would release those pages. But now, in certain cases when there is a mixed buffered write in the system, those dontcache dirty pages might be written back after a delay (whenever the next time writeback kicks in).
However for RWF_DONTCACHE reads, it should not affect anything.

Looks like DONTCACHE is documented in the preadv/writev manpage. Here's the current blurb about writes:

Additionally, any range dirtied by a write operation with RWF_DONT‐ CACHE set will get kicked off for writeback. This is similar to calling sync_file_range(2) with SYNC_FILE_RANGE_WRITE to start writeback on the given range. RWF_DONTCACHE is a hint, or best ef‐ fort, where no hard guarantees are given on the state of the page cache once the operation completes.

I don't think this verbiage is invalid after this change. Kicking off writeback is still just a hint, like it was before. We could mention about how that I/O can compete with regular buffered I/O, but it seems a bit like we're adding info that will just be confusing for users.

Quoted 13 lines
Quoted 4 lines

Like WB_start_all, the WB_start_dontcache bit coalesces multiple DONTCACHE writes into a single flusher wakeup without per-write allocations.

Quoted 8 lines

Also add WB_REASON_DONTCACHE as a new writeback reason for tracing visibility, and target the correct cgroup writeback domain via unlocked_inode_to_wb_begin().

dontcache-bench results on dual-socket Xeon Gold 6138 (80 CPUs, 256 GB RAM, Samsung MZ1LB1T9HALS 1.7 TB NVMe, local XFS, io_uring, file size ~503 GB, compared to a v6.19-ish baseline):

Quoted 5 lines

Can we please also test parallel buffered writes and dontcache writes? Since this patch series definitely affects that.

BTW - adding these numbers in the commit msg itself is much helpful.

To be clear, this only affects DONTCACHE, not normal buffered writes, but I guess you're referring to the fact that DONTCACHE and buffered writes can compete now.

Can you clarify specifically what you'd like me to test here? Are you saying you want me to test parallel and buffered writes together at the same time (i.e. make them compete?).

I should be able to do that for the local benchmarks, but nfsd's iomode settings are global and that won't be possible there.

Quoted 30 lines
Quoted 16 lines

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              1449.8     1440.1      -0.7%
  dontcache             1347.9     1461.5      +8.4%
  direct                1450.0     1440.1      -0.7%

Single-client sequential write latency (us):
baseline patched change

  dontcache p50         3031.0    10551.3    +248.1%
  dontcache p99        74973.2    21626.9     -71.2%
  dontcache p99.9      85459.0    23199.7     -72.9%

Single-client random write (MB/s):
baseline patched change
dontcache 284.2 295.4 +3.9%

Quoted 5 lines

Single-client random write p99.9 latency (us):
baseline patched change
dontcache 2277.4 872.4 -61.7%

Multi-writer aggregate throughput (MB/s):

Can you please help describe this test scenario if possible.. In above you mentioned we are writing file_size as 2x RAM_SIZE. But your multi-client tests says something else..

local num_clients=4

(quoted diff) +2 -0
+	mem_kb=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
+	client_size="$(( mem_kb / 1024 / num_clients ))M"
Quoted 6 lines

Also the multi-writer case is spawning parallel fio jobs, and then parsing and aggregating the bandwidth results instead of using fio to spawn multiple parallel threads... which is ok, but a bit wierd. Why not let fio do the aggregate bandwidth, and latency calculation instead?

That's what I get for asking Claude to roll a testsuite. I'm not that well-versed in fio, but that makes sense. I'll have a look at reworking it along those lines.

Quoted 45 lines
Quoted 39 lines
                       baseline    patched     change
  buffered              1619.5     1611.2      -0.5%
  dontcache             1281.1     1629.4     +27.2%
  direct                1545.4     1609.4      +4.1%

Mixed-mode noisy neighbor (dontcache writer + buffered readers):
baseline patched change
writer (MB/s) 1297.6 1471.1 +13.4%
readers avg (MB/s) 855.0 462.4 -45.9%

nfsd-io-bench results on same hardware (XFS on NVMe, NFSv3 via fio NFS engine with libnfs, 1024 NFSD threads, pool_mode=pernode, file size ~502 GB, compared to v6.19-ish baseline):

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              4844.2     4653.4      -3.9%
  dontcache             3028.3     3723.1     +22.9%

direct 957.6 987.8 +3.2%

Single-client sequential write p99.9 latency (us):
baseline patched change
dontcache 759169.0 175112.2 -76.9%

Single-client random write (MB/s):
baseline patched change
dontcache 590.0 1561.0 +164.6%

Multi-writer aggregate throughput (MB/s):

                       baseline    patched     change
  buffered              9636.3     9422.9      -2.2%
  dontcache             1894.9     9442.6    +398.3%

direct 809.6 975.1 +20.4%

Noisy neighbor (dontcache writer + random readers):
baseline patched change
writer (MB/s) 1854.5 4063.6 +119.1%
readers avg (MB/s) 131.2 101.6 -22.5%

Quoted 5 lines

The NFS results show even larger improvements than the local benchmarks. Multi-writer dontcache throughput improves nearly 5x, matching buffered I/O. Dirty page footprint drops 85-95% in sequential workloads vs. buffered.

Quoted 5 lines

Nice :)
Some explaination here of why 5x improvement with NFS compared to local filesystems please?
(I am not much aware of NFS side, but a possible reasoning would help)

I suspect that it's because of the "scattered" nature of nfsd writes. When the client sends a write to nfsd, we wake a nfsd thread to service it. So, if there are a lot of writes operating in parallel, they all get done in the context of different tasks.

My hunch is that this I/O pattern (writing to same file from a bunch of different threads), particularly suffers from the DONTCACHE inline write behavior. The threads all end up competing to submit jobs to the queue and that causes the performance to fall off sharply.

Thanks for the review!

Signature · 1 line
Jeff Layton <[email protected]>
#10 lore raw

Re: [PATCH v3 2/4] mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking

Quoted 21 lines · Jeff Layton
Quoted 10 lines

Also should the following change be documented somewhere? Like in Man page maybe? i.e.
Earlier RWF_DONTCACHE writes made sure that those dirty pages are immediately submitted for writeback and completion would release those pages. But now, in certain cases when there is a mixed buffered write in the system, those dontcache dirty pages might be written back after a delay (whenever the next time writeback kicks in).
However for RWF_DONTCACHE reads, it should not affect anything.

Looks like DONTCACHE is documented in the preadv/writev manpage. Here's the current blurb about writes:

Additionally, any range dirtied by a write operation with RWF_DONT‐ CACHE set will get kicked off for writeback. This is similar to calling sync_file_range(2) with SYNC_FILE_RANGE_WRITE to start writeback on the given range. RWF_DONTCACHE is a hint, or best ef‐ fort, where no hard guarantees are given on the state of the page cache once the operation completes.

Quoted 5 lines

I don't think this verbiage is invalid after this change. Kicking off writeback is still just a hint, like it was before. We could mention about how that I/O can compete with regular buffered I/O, but it seems a bit like we're adding info that will just be confusing for users.

Make sense.

Quoted 15 lines
Quoted 10 lines
Quoted 4 lines

dontcache-bench results on dual-socket Xeon Gold 6138 (80 CPUs, 256 GB RAM, Samsung MZ1LB1T9HALS 1.7 TB NVMe, local XFS, io_uring, file size ~503 GB, compared to a v6.19-ish baseline):

Can we please also test parallel buffered writes and dontcache writes? Since this patch series definitely affects that.

BTW - adding these numbers in the commit msg itself is much helpful.

To be clear, this only affects DONTCACHE, not normal buffered writes, but I guess you're referring to the fact that DONTCACHE and buffered writes can compete now.

Quoted 7 lines

Can you clarify specifically what you'd like me to test here? Are you saying you want me to test parallel and buffered writes together at the same time (i.e. make them compete?).

I should be able to do that for the local benchmarks, but nfsd's iomode settings are global and that won't be possible there.

The reason I am thinking of this is: dontcache marked pages, gets evicted from page cache after they are written back. But this patch series can now delay that from happening when there is a parallel buffered writer dirtying page cache pages. Because of the reasons we already discussed...

Note that, this may not be a workload which matters in the real world, but I was thinking, it will be good to know the impact if any, of such workload with this patch series (parallel buffered and dontcache writers).

Quoted 22 lines
Quoted 22 lines
Quoted 21 lines

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              1449.8     1440.1      -0.7%
  dontcache             1347.9     1461.5      +8.4%
  direct                1450.0     1440.1      -0.7%

Single-client sequential write latency (us):
baseline patched change

  dontcache p50         3031.0    10551.3    +248.1%
  dontcache p99        74973.2    21626.9     -71.2%
  dontcache p99.9      85459.0    23199.7     -72.9%

Single-client random write (MB/s):
baseline patched change
dontcache 284.2 295.4 +3.9%

Single-client random write p99.9 latency (us):
baseline patched change
dontcache 2277.4 872.4 -61.7%

Multi-writer aggregate throughput (MB/s):

Quoted 8 lines

Review

Quoted 8 lines

Can you please help describe this test scenario if possible.. In above you mentioned we are writing file_size as 2x RAM_SIZE. But your multi-client tests says something else..

local num_clients=4

(quoted diff) +2 -0
+	mem_kb=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
+	client_size="$(( mem_kb / 1024 / num_clients ))M"

I guess you missed answering this. The reason why I was asking about this is....

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
                       baseline    patched     change
  buffered              1619.5     1611.2      -0.5%
  dontcache             1281.1     1629.4     +27.2%
  direct                1545.4     1609.4      +4.1%

... If we see the performace of buffered and dontcache in baseline case, then we don't see dontcache doing any good. Even the patched version is just slightly better compared to buffered case.

But IIUC, dontcache should really shine in cases where we have buffered writers dirtying the page cache pages which can overflow the RAM size [1]. The reason why dontcache should show benefit there is, because we don't see any page cache pressure, since after writeback the pages gets evicted. Also earlier in the unpatched version, the I/O submission happens immediately in the same context.

So, I guess, isn't it better to evaluate those scenarios as well with the patched version - since this series affects those code paths now?

[1]: https://lore.kernel.org/all/[email protected]/

Quoted 12 lines
Quoted 6 lines

Nice :)
Some explaination here of why 5x improvement with NFS compared to local filesystems please?
(I am not much aware of NFS side, but a possible reasoning would help)

I suspect that it's because of the "scattered" nature of nfsd writes. When the client sends a write to nfsd, we wake a nfsd thread to service it. So, if there are a lot of writes operating in parallel, they all get done in the context of different tasks.

Quoted 5 lines

My hunch is that this I/O pattern (writing to same file from a bunch of different threads), particularly suffers from the DONTCACHE inline write behavior. The threads all end up competing to submit jobs to the queue and that causes the performance to fall off sharply.

Thanks!

-ritesh

author maintainer
#11 lore raw

Re: [PATCH v3 2/4] mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking

Quoted 4 lines · Ritesh Harjani
Quoted 1 line

I guess you missed answering this. The reason why I was asking about this is....

Oops, sorry...

Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
                       baseline    patched     change
  buffered              1619.5     1611.2      -0.5%
  dontcache             1281.1     1629.4     +27.2%
  direct                1545.4     1609.4      +4.1%

... If we see the performace of buffered and dontcache in baseline case, then we don't see dontcache doing any good. Even the patched version is just slightly better compared to buffered case.

But IIUC, dontcache should really shine in cases where we have buffered writers dirtying the page cache pages which can overflow the RAM size [1]. The reason why dontcache should show benefit there is, because we don't see any page cache pressure, since after writeback the pages gets evicted. Also earlier in the unpatched version, the I/O submission happens immediately in the same context.

Quoted 6 lines

So, I guess, isn't it better to evaluate those scenarios as well with the patched version - since this series affects those code paths now?

[1]: https://lore.kernel.org/all/[email protected]/

Quoted 1 line

Ok, that's a good point. I'll have Claude recreate a benchmark that mirrors what Jens did in the original posting and make sure the behavior of that test doesn't regress (at least not significantly).

I'll try to get this done before LSF/MM, but we'll see.

Cheers,

Signature · 1 line
Jeff Layton <[email protected]>
maintainer
#12 lore raw

Re: [PATCH v3 2/4] mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking

In reply to Jeff Layton
Quoted 91 lines · Jeff Layton

The IOCB_DONTCACHE writeback path in generic_write_sync() calls filemap_flush_range() on every write, submitting writeback inline in the writer's context. Perf lock contention profiling shows the performance problem is not lock contention but the writeback submission work itself — walking the page tree and submitting I/O blocks the writer for milliseconds, inflating p99.9 latency from 23ms (buffered) to 93ms (dontcache).

Replace the inline filemap_flush_range() call with a flusher kick that drains dirty pages in the background. This moves writeback submission completely off the writer's hot path.

To avoid flushing unrelated buffered dirty data, add a dedicated WB_start_dontcache bit and wb_check_start_dontcache() handler that uses the new NR_DONTCACHE_DIRTY counter to determine how many pages to write back. The flusher writes back that many pages from the oldest dirty inodes (not restricted to dontcache-specific inodes). This helps preserve I/O batching while limiting the scope of expedited writeback.

Like WB_start_all, the WB_start_dontcache bit coalesces multiple DONTCACHE writes into a single flusher wakeup without per-write allocations.

Also add WB_REASON_DONTCACHE as a new writeback reason for tracing visibility, and target the correct cgroup writeback domain via unlocked_inode_to_wb_begin().

dontcache-bench results on dual-socket Xeon Gold 6138 (80 CPUs, 256 GB RAM, Samsung MZ1LB1T9HALS 1.7 TB NVMe, local XFS, io_uring, file size ~503 GB, compared to a v6.19-ish baseline):

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              1449.8     1440.1      -0.7%
  dontcache             1347.9     1461.5      +8.4%
  direct                1450.0     1440.1      -0.7%

Single-client sequential write latency (us):
baseline patched change

  dontcache p50         3031.0    10551.3    +248.1%
  dontcache p99        74973.2    21626.9     -71.2%
  dontcache p99.9      85459.0    23199.7     -72.9%

Single-client random write (MB/s):
baseline patched change
dontcache 284.2 295.4 +3.9%

Single-client random write p99.9 latency (us):
baseline patched change
dontcache 2277.4 872.4 -61.7%

Multi-writer aggregate throughput (MB/s):

                       baseline    patched     change
  buffered              1619.5     1611.2      -0.5%
  dontcache             1281.1     1629.4     +27.2%
  direct                1545.4     1609.4      +4.1%

Mixed-mode noisy neighbor (dontcache writer + buffered readers):
baseline patched change
writer (MB/s) 1297.6 1471.1 +13.4%
readers avg (MB/s) 855.0 462.4 -45.9%

nfsd-io-bench results on same hardware (XFS on NVMe, NFSv3 via fio NFS engine with libnfs, 1024 NFSD threads, pool_mode=pernode, file size ~502 GB, compared to v6.19-ish baseline):

Single-client sequential write (MB/s):

                       baseline    patched     change
  buffered              4844.2     4653.4      -3.9%
  dontcache             3028.3     3723.1     +22.9%

direct 957.6 987.8 +3.2%

Single-client sequential write p99.9 latency (us):
baseline patched change
dontcache 759169.0 175112.2 -76.9%

Single-client random write (MB/s):
baseline patched change
dontcache 590.0 1561.0 +164.6%

Multi-writer aggregate throughput (MB/s):

                       baseline    patched     change
  buffered              9636.3     9422.9      -2.2%
  dontcache             1894.9     9442.6    +398.3%

direct 809.6 975.1 +20.4%

Noisy neighbor (dontcache writer + random readers):
baseline patched change
writer (MB/s) 1854.5 4063.6 +119.1%
readers avg (MB/s) 131.2 101.6 -22.5%

Quoted 7 lines

The NFS results show even larger improvements than the local benchmarks. Multi-writer dontcache throughput improves nearly 5x, matching buffered I/O. Dirty page footprint drops 85-95% in sequential workloads vs. buffered.

Assisted-by Claude:claude-opus-4-6

One comment regarding how the writeback is started:

Quoted 12 lines
fs/fs-writeback.c +12 -0
+static long wb_check_start_dontcache(struct bdi_writeback *wb)
+{
+	long nr_pages;
+
+	if (!test_bit(WB_start_dontcache, &wb->state))
+		return 0;
+
+	nr_pages = global_node_page_state(NR_DONTCACHE_DIRTY);
+	if (nr_pages) {
+		struct wb_writeback_work work = {
+			.nr_pages	= wb_split_bdi_pages(wb, nr_pages),
+			.sync_mode	= WB_SYNC_NONE,

fs/fs-writeback.c static long wb_check_start_all(struct bdi_writeback *wb) · line 2409

Quoted 10 lines
fs/fs-writeback.c +10 -0
+			.range_cyclic	= 1,
+			.reason		= WB_REASON_DONTCACHE,
+		};
+
+		nr_pages = wb_writeback(wb, &work);
+	}
+
+	clear_bit(WB_start_dontcache, &wb->state);
+	return nr_pages;
+}

So this will end up splitting NR_DONTCACHE_DIRTY folios among per-cgroup wb structures based on their writeback bandwidth. This is a reasonable thing for global writeback where the bandwidth more or less corresponds to the amount of dirty folios. However with DONTCACHE I expect big differences in among NR_DONTCACHE_DIRTY among different cgroups not necessarily corresponding to wb throughput. In particular if you do DONTCACHE writes from one cgroup and normal writes from another cgroup this will systematically underestimate the amount needed to write by a factor of about two.

So I think the stat should be a per bdi_writeback one (instead of a per node one) which would avoid the need to split the value to wb here.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
author maintainer
#13 lore raw

PATCH v3 3/4 testing: add nfsd-io-bench NFS server benchmark suite

In reply to Jeff Layton

Add a benchmark suite for testing NFSD I/O mode performance using fio with the libnfs backend against an NFS server on localhost. Tests buffered, dontcache, and direct I/O modes via NFSD debugfs controls.

Includes:
- fio job files for sequential/random read/write, multi-writer, noisy-neighbor, and latency-sensitive reader workloads
- run-benchmarks.sh: orchestrates test matrix with mode switching
- parse-results.sh: extracts metrics from fio JSON output
- setup-server.sh: configures NFS export for testing

Assisted-by Claude:claude-opus-4-6
---
 .../testing/nfsd-io-bench/fio-jobs/lat-reader.fio  |  15 +
 .../testing/nfsd-io-bench/fio-jobs/multi-write.fio |  14 +
 .../nfsd-io-bench/fio-jobs/noisy-writer.fio        |  14 +
 tools/testing/nfsd-io-bench/fio-jobs/rand-read.fio |  15 +
 .../testing/nfsd-io-bench/fio-jobs/rand-write.fio  |  15 +
 tools/testing/nfsd-io-bench/fio-jobs/seq-read.fio  |  14 +
 tools/testing/nfsd-io-bench/fio-jobs/seq-write.fio |  14 +
 .../testing/nfsd-io-bench/scripts/parse-results.sh | 238 +++++++++
 .../nfsd-io-bench/scripts/run-benchmarks.sh        | 591 +++++++++++++++++++++
 .../testing/nfsd-io-bench/scripts/setup-server.sh  |  94 ++++
 10 files changed, 1024 insertions(+)
tools/testing/nfsd-io-bench/fio-jobs/lat-reader.fio new file +15 -0
new file mode 100644
index 000000000000..61af37e8b860
@@ -0,0 +1,15 @@
+[global]
+ioengine=nfs
+nfs_url=nfs://localhost/export
+direct=0
+bs=4k
+numjobs=16
+runtime=300
+time_based=1
+group_reporting=1
+rw=randread
+log_avg_msec=1000
+write_bw_log=latreader
+write_lat_log=latreader
+
+[lat_reader]
tools/testing/nfsd-io-bench/fio-jobs/multi-write.fio new file +14 -0
new file mode 100644
index 000000000000..16b792aecabb
@@ -0,0 +1,14 @@
+[global]
+ioengine=nfs
+nfs_url=nfs://localhost/export
+direct=0
+bs=1M
+numjobs=16
+time_based=0
+group_reporting=1
+rw=write
+log_avg_msec=1000
+write_bw_log=multiwrite
+write_lat_log=multiwrite
+
+[writer]
tools/testing/nfsd-io-bench/fio-jobs/noisy-writer.fio new file +14 -0
new file mode 100644
index 000000000000..615154a7737e
@@ -0,0 +1,14 @@
+[global]
+ioengine=nfs
+nfs_url=nfs://localhost/export
+direct=0
+bs=1M
+numjobs=16
+time_based=0
+group_reporting=1
+rw=write
+log_avg_msec=1000
+write_bw_log=noisywriter
+write_lat_log=noisywriter
+
+[bulk_writer]
tools/testing/nfsd-io-bench/fio-jobs/rand-read.fio new file +15 -0
new file mode 100644
index 000000000000..501bae7416a8
@@ -0,0 +1,15 @@
+[global]
+ioengine=nfs
+nfs_url=nfs://localhost/export
+direct=0
+bs=4k
+numjobs=16
+runtime=300
+time_based=1
+group_reporting=1
+rw=randread
+log_avg_msec=1000
+write_bw_log=randread
+write_lat_log=randread
+
+[randread]
tools/testing/nfsd-io-bench/fio-jobs/rand-write.fio new file +15 -0
new file mode 100644
index 000000000000..d891d04197ae
@@ -0,0 +1,15 @@
+[global]
+ioengine=nfs
+nfs_url=nfs://localhost/export
+direct=0
+bs=64k
+numjobs=16
+runtime=300
+time_based=1
+group_reporting=1
+rw=randwrite
+log_avg_msec=1000
+write_bw_log=randwrite
+write_lat_log=randwrite
+
+[randwrite]
tools/testing/nfsd-io-bench/fio-jobs/seq-read.fio new file +14 -0
new file mode 100644
index 000000000000..6e24ab355026
@@ -0,0 +1,14 @@
+[global]
+ioengine=nfs
+nfs_url=nfs://localhost/export
+direct=0
+bs=1M
+numjobs=16
+time_based=0
+group_reporting=1
+rw=read
+log_avg_msec=1000
+write_bw_log=seqread
+write_lat_log=seqread
+
+[seqread]
tools/testing/nfsd-io-bench/fio-jobs/seq-write.fio new file +14 -0
new file mode 100644
index 000000000000..260858e345f5
@@ -0,0 +1,14 @@
+[global]
+ioengine=nfs
+nfs_url=nfs://localhost/export
+direct=0
+bs=1M
+numjobs=16
+time_based=0
+group_reporting=1
+rw=write
+log_avg_msec=1000
+write_bw_log=seqwrite
+write_lat_log=seqwrite
+
+[seqwrite]
tools/testing/nfsd-io-bench/scripts/parse-results.sh new file +238 -0

238 lines not on this page · raw message

tools/testing/nfsd-io-bench/scripts/run-benchmarks.sh new file +591 -0

591 lines not on this page · raw message

tools/testing/nfsd-io-bench/scripts/setup-server.sh new file +94 -0

94 lines not on this page · raw message

Signature · 1 line
2.53.0
maintainer
#14 lore raw

Re: [PATCH v3 3/4] testing: add nfsd-io-bench NFS server benchmark suite

Quoted 4 lines · On Sun, 26 Apr 2026 07:56:09 -0400 Jeff Layton <[email protected]> wrote:

Add a benchmark suite for testing NFSD I/O mode performance using fio with the libnfs backend against an NFS server on localhost. Tests buffered, dontcache, and direct I/O modes via NFSD debugfs controls.

Quoted 8 lines

Includes:
- fio job files for sequential/random read/write, multi-writer, noisy-neighbor, and latency-sensitive reader workloads
- run-benchmarks.sh: orchestrates test matrix with mode switching
- parse-results.sh: extracts metrics from fio JSON output
- setup-server.sh: configures NFS export for testing

Assisted-by Claude:claude-opus-4-6

OK, question.

Quoted 1 line
 10 files changed, 1024 insertions(+)

Seems that this code was largely machine-generated. So I assume that you're in possession of the scripts/prompts/whatever which were used to generate this code.

(Can you please briefly describe the process which you used here?)

So how are we to maintain this? Will other developers have to go in and hack this machine-generated output by hand? Or would it be better to provide (in-tree) other developers with the means to regenerate this code, presumably using Claude?

IOW, this feels a bit like shipping the .s file without giving us the .c file!

author maintainer
#15 lore raw

Re: [PATCH v3 3/4] testing: add nfsd-io-bench NFS server benchmark suite

Quoted 17 lines · Andrew Morton
Quoted 4 lines · On Sun, 26 Apr 2026 07:56:09 -0400 Jeff Layton <[email protected]> wrote:

Add a benchmark suite for testing NFSD I/O mode performance using fio with the libnfs backend against an NFS server on localhost. Tests buffered, dontcache, and direct I/O modes via NFSD debugfs controls.

Quoted 8 lines

Includes:
- fio job files for sequential/random read/write, multi-writer, noisy-neighbor, and latency-sensitive reader workloads
- run-benchmarks.sh: orchestrates test matrix with mode switching
- parse-results.sh: extracts metrics from fio JSON output
- setup-server.sh: configures NFS export for testing

Assisted-by Claude:claude-opus-4-6

OK, question.

Quoted 8 lines
Quoted 1 line
 10 files changed, 1024 insertions(+)

Seems that this code was largely machine-generated. So I assume that you're in possession of the scripts/prompts/whatever which were used to generate this code.

(Can you please briefly describe the process which you used here?)

It's been a while since it generated these, but I think I just asked it to concoct a set of benchmarks for DONTCACHE writes when that involved file sizes that were larger than the machine's memory.

I ended up asking it to make some changes (e.g. the mixed-mode test, and some of the perf stuff), but it seemed to do a reasonable job of creating it.

Quoted 7 lines

So how are we to maintain this? Will other developers have to go in and hack this machine-generated output by hand? Or would it be better to provide (in-tree) other developers with the means to regenerate this code, presumably using Claude?

IOW, this feels a bit like shipping the .s file without giving us the .c file!

As I mentioned in the cover letter, I mostly included this in the series to demonstrate how this was tested. I'm not sure if the two benchmark suites are suitable for inclusion. I'm fine with leaving those two patches out of the merge. I found the testcases useful for this, but they are indeed AI slop, and I'm not sure they have long-term value or will be maintainable.

Signature · 1 line
Jeff Layton <[email protected]>
#16 lore raw

Re: [PATCH v3 3/4] testing: add nfsd-io-bench NFS server benchmark suite

Quoted 2 lines · Jeff Layton
Quoted 1 line · Andrew Morton

So how are we to maintain this?

Maybe in xfstests? It has tests/perf/, but that just have 1 test. Maybe others can tell whether it make sense to maintain such fio based performance benchmarking scripts in there.

-ritesh

author maintainer
#17 lore raw

PATCH v3 4/4 testing: add dontcache-bench local filesystem benchmark suite

In reply to Jeff Layton

Add a benchmark suite for testing IOCB_DONTCACHE on local filesystems via fio's io_uring engine with the RWF_DONTCACHE flag.

The suite mirrors the nfsd-io-bench test matrix but uses io_uring with the "uncached" fio option instead of NFSD debugfs mode switching:
- uncached=0: standard buffered I/O
- uncached=1: RWF_DONTCACHE
- Mode 2 uses O_DIRECT via fio's --direct=1

Includes fio job files, run-benchmarks.sh, and parse-results.sh.

Assisted-by Claude:claude-opus-4-6
---
 .../dontcache-bench/fio-jobs/lat-reader.fio        |  12 +
 .../dontcache-bench/fio-jobs/multi-write.fio       |   9 +
 .../dontcache-bench/fio-jobs/noisy-writer.fio      |  12 +
 .../testing/dontcache-bench/fio-jobs/rand-read.fio |  13 +
 .../dontcache-bench/fio-jobs/rand-write.fio        |  13 +
 .../testing/dontcache-bench/fio-jobs/seq-read.fio  |  13 +
 .../testing/dontcache-bench/fio-jobs/seq-write.fio |  13 +
 .../dontcache-bench/scripts/parse-results.sh       | 238 +++++++++
 .../dontcache-bench/scripts/run-benchmarks.sh      | 562 +++++++++++++++++++++
 9 files changed, 885 insertions(+)
tools/testing/dontcache-bench/fio-jobs/lat-reader.fio new file +12 -0
new file mode 100644
index 000000000000..e221e7aedec9
@@ -0,0 +1,12 @@
+[global]
+ioengine=io_uring
+direct=0
+bs=4k
+numjobs=1
+time_based=0
+rw=read
+log_avg_msec=1000
+write_bw_log=latreader
+write_lat_log=latreader
+
+[latreader]
tools/testing/dontcache-bench/fio-jobs/multi-write.fio new file +9 -0
new file mode 100644
index 000000000000..8fc0770f5860
@@ -0,0 +1,9 @@
+[global]
+ioengine=io_uring
+direct=0
+bs=1M
+numjobs=1
+time_based=0
+rw=write
+
+[multiwrite]
tools/testing/dontcache-bench/fio-jobs/noisy-writer.fio new file +12 -0
new file mode 100644
index 000000000000..4524eebd4642
@@ -0,0 +1,12 @@
+[global]
+ioengine=io_uring
+direct=0
+bs=1M
+numjobs=1
+time_based=0
+rw=write
+log_avg_msec=1000
+write_bw_log=noisywriter
+write_lat_log=noisywriter
+
+[noisywriter]
tools/testing/dontcache-bench/fio-jobs/rand-read.fio new file +13 -0
new file mode 100644
index 000000000000..e281fa82b86a
@@ -0,0 +1,13 @@
+[global]
+ioengine=io_uring
+direct=0
+bs=4k
+numjobs=1
+iodepth=16
+time_based=0
+rw=randread
+log_avg_msec=1000
+write_bw_log=randread
+write_lat_log=randread
+
+[randread]
tools/testing/dontcache-bench/fio-jobs/rand-write.fio new file +13 -0
new file mode 100644
index 000000000000..cf53bc6f14b9
@@ -0,0 +1,13 @@
+[global]
+ioengine=io_uring
+direct=0
+bs=4k
+numjobs=1
+iodepth=16
+time_based=0
+rw=randwrite
+log_avg_msec=1000
+write_bw_log=randwrite
+write_lat_log=randwrite
+
+[randwrite]
tools/testing/dontcache-bench/fio-jobs/seq-read.fio new file +13 -0
new file mode 100644
index 000000000000..ef87921465a7
@@ -0,0 +1,13 @@
+[global]
+ioengine=io_uring
+direct=0
+bs=1M
+numjobs=1
+iodepth=16
+time_based=0
+rw=read
+log_avg_msec=1000
+write_bw_log=seqread
+write_lat_log=seqread
+
+[seqread]
tools/testing/dontcache-bench/fio-jobs/seq-write.fio new file +13 -0
new file mode 100644
index 000000000000..da3082f9b391
@@ -0,0 +1,13 @@
+[global]
+ioengine=io_uring
+direct=0
+bs=1M
+numjobs=1
+iodepth=16
+time_based=0
+rw=write
+log_avg_msec=1000
+write_bw_log=seqwrite
+write_lat_log=seqwrite
+
+[seqwrite]
tools/testing/dontcache-bench/scripts/parse-results.sh new file +238 -0

238 lines not on this page · raw message

tools/testing/dontcache-bench/scripts/run-benchmarks.sh new file +562 -0

562 lines not on this page · raw message

Signature · 1 line
2.53.0
syzbot Tested-by [email protected] on the v3 series
#18 lore raw
In reply to Jeff Layton
syzbot ci has tested the following series

syzbot ci has tested the following series

[v3] mm: improve write performance with RWF_DONTCACHE
https://lore.kernel.org/all/[email protected]
* [PATCH v3 1/4] mm: add NR_DONTCACHE_DIRTY node page counter
* [PATCH v3 2/4] mm: kick writeback flusher for IOCB_DONTCACHE with targeted dirty tracking
* [PATCH v3 3/4] testing: add nfsd-io-bench NFS server benchmark suite
* [PATCH v3 4/4] testing: add dontcache-bench local filesystem benchmark suite

and found the following issue:
WARNING in __mod_memcg_lruvec_state

Full report is available here:
https://ci.syzbot.org/series/e53aef43-ac7a-4cb7-8714-bb927aaee659

***

WARNING in __mod_memcg_lruvec_state

tree:      torvalds
URL:       https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
base:      27d128c1cff64c3b8012cc56dd5a1391bb4f1821
arch:      amd64
compiler:  Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
config:    https://ci.syzbot.org/builds/c10ddd10-bb16-48c2-90fb-3625d3b258aa/config
syz repro: https://ci.syzbot.org/findings/1e8993c1-818b-4ddf-b90b-30f051b3a9d6/syz_repro
------------[ cut here ]------------
__mod_memcg_lruvec_state: missing stat item 21
WARNING: mm/memcontrol.c:911 at __mod_memcg_lruvec_state+0x1f3/0x360 mm/memcontrol.c:911, CPU#0: syz.0.17/5831
Modules linked in:
CPU: 0 UID: 0 PID: 5831 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:__mod_memcg_lruvec_state+0x1fc/0x360 mm/memcontrol.c:911
Code: 00 11 85 c0 74 31 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d e9 95 2e 72 09 cc 48 8d 3d 7d c4 fd 0d 48 c7 c6 5d b4 f5 8d 89 da <67> 48 0f b9 3a eb d5 90 0f 0b 90 eb 90 e8 02 22 fb fe eb c8 48 8d
RSP: 0018:ffffc900039e7520 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000015 RCX: dffffc0000000000
RDX: 0000000000000015 RSI: ffffffff8df5b45d RDI: ffffffff90363d90
RBP: 0000000000000001 R08: ffffffff82388833 R09: ffffffff8e95cd60
R10: dffffc0000000000 R11: fffff940008c3f49 R12: ffff8881026eee80
R13: 00000000000000ff R14: 0000000000000001 R15: ffff888173a80e00
FS:  00007f5f76bca6c0(0000) GS:ffff88818dc95000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055d77c624128 CR3: 0000000171fde000 CR4: 00000000000006f0
Call Trace:
 <TASK>
 mod_memcg_lruvec_state+0xa7/0x220 mm/memcontrol.c:941
 mod_lruvec_state mm/memcontrol.c:964 [inline]
 lruvec_stat_mod_folio+0x239/0x3e0 mm/memcontrol.c:984
 folio_account_dirtied mm/page-writeback.c:2634 [inline]
 __folio_mark_dirty+0x633/0xec0 mm/page-writeback.c:2692
 mark_buffer_dirty+0x261/0x410 fs/buffer.c:1110
 block_commit_write+0x15d/0x270 fs/buffer.c:2115
 block_write_end+0x6e/0xb0 fs/buffer.c:2191
 ext4_write_end+0x27d/0xa30 fs/ext4/inode.c:1458
 ext4_da_write_end+0x86/0xcb0 fs/ext4/inode.c:3296
 generic_perform_write+0x620/0x8f0 mm/filemap.c:4350
 ext4_buffered_write_iter+0xcb/0x370 fs/ext4/file.c:316
 ext4_file_write_iter+0x298/0x1bd0 fs/ext4/file.c:-1
 do_iter_readv_writev+0x619/0x8c0 fs/read_write.c:-1
 vfs_writev+0x33c/0x990 fs/read_write.c:1059
 do_pwritev fs/read_write.c:1155 [inline]
 __do_sys_pwritev2 fs/read_write.c:1213 [inline]
 __se_sys_pwritev2+0x184/0x2a0 fs/read_write.c:1204
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x15f/0xf80 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5f75d9cdd9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f5f76bca028 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 00007f5f76015fa0 RCX: 00007f5f75d9cdd9
RDX: 0000000000000001 RSI: 00002000000001c0 RDI: 0000000000000004
RBP: 00007f5f75e32d69 R08: 0000000000000001 R09: 0000000000000081
R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f5f76016038 R14: 00007f5f76015fa0 R15: 00007fffe7503ad8
 </TASK>
----------------
Code disassembly (best guess):
   0:	00 11                	add    %dl,(%rcx)
   2:	85 c0                	test   %eax,%eax
   4:	74 31                	je     0x37
   6:	48 83 c4 08          	add    $0x8,%rsp
   a:	5b                   	pop    %rbx
   b:	41 5c                	pop    %r12
   d:	41 5d                	pop    %r13
   f:	41 5e                	pop    %r14
  11:	41 5f                	pop    %r15
  13:	5d                   	pop    %rbp
  14:	e9 95 2e 72 09       	jmp    0x9722eae
  19:	cc                   	int3
  1a:	48 8d 3d 7d c4 fd 0d 	lea    0xdfdc47d(%rip),%rdi        # 0xdfdc49e
  21:	48 c7 c6 5d b4 f5 8d 	mov    $0xffffffff8df5b45d,%rsi
  28:	89 da                	mov    %ebx,%edx
* 2a:	67 48 0f b9 3a       	ud1    (%edx),%rdi <-- trapping instruction
  2f:	eb d5                	jmp    0x6
  31:	90                   	nop
  32:	0f 0b                	ud2
  34:	90                   	nop
  35:	eb 90                	jmp    0xffffffc7
  37:	e8 02 22 fb fe       	call   0xfefb223e
  3c:	eb c8                	jmp    0x6
  3e:	48                   	rex.W
  3f:	8d                   	.byte 0x8d

***

If these findings have caused you to resend the series or submit a separate fix, please add the following tag to your commit message:

---
This report is generated by a bot. It may contain errors. syzbot ci engineers can be reached at [email protected].

To test a patch for this bug, please reply with #syz test (should be on a separate line).

The patch should be attached to the email.
Note: arguments like custom git repos and branches are not supported.