From b3576f2ae64107eb6959e3e360291320d1c3d0b2 Mon Sep 17 00:00:00 2001 From: MattJackson <1085847+MattJackson@users.noreply.github.com> Date: Sat, 16 May 2026 09:30:44 -0700 Subject: [PATCH] Revert "io/writeback: WRITEBACK_CHUNK_BYTES 32 -> 128 MiB" This reverts commit 50867516b8ba0177bed01eb05ac450de4d050387. --- src/io/writeback_file/mod.rs | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/io/writeback_file/mod.rs b/src/io/writeback_file/mod.rs index c9cbdba..086ec4f 100644 --- a/src/io/writeback_file/mod.rs +++ b/src/io/writeback_file/mod.rs @@ -121,24 +121,10 @@ use std::thread::{self, JoinHandle}; use super::writeback::WritebackPipeline; -/// Initial granularity at which the Linux writeback pipeline issues -/// `sync_file_range` / `posix_fadvise(DONTNEED)` pairs. The pipeline's -/// adaptive autotuner grows/shrinks this between -/// [`super::writeback::linux::CHUNK_BYTES_MIN`] and `CHUNK_BYTES_MAX` -/// based on p95 of `WAIT_AFTER` latency. -/// -/// 0.21.14: bumped from 32 MiB to 128 MiB. On NFS, -/// `sync_file_range(WAIT_AFTER)` translates to an NFS COMMIT RPC whose -/// completion ack arrives within ~10 ms (measured via mountstats), so -/// the adaptive autotuner — which only grows when p95 > 200 ms — -/// never triggered and the pipeline sat at 32 MiB forever, paying -/// COMMIT-RPC overhead per ~1 s of writes. Empirical 2026-05-15: -/// bidirectional mux on rip1 capped at ~29 MB/s write side while the -/// rig's bidirectional dd ceiling is ~91 MB/s write + ~65 MB/s read. -/// At a larger initial chunk the COMMIT cadence drops 4×, leaving -/// the dirty-cache invariant intact (bounded at ~2 × chunk = 256 MiB, -/// well under the kernel's `vm.dirty_ratio` cap on a 32 GB rig). -const WRITEBACK_CHUNK_BYTES: u64 = 128 * 1024 * 1024; +/// Granularity at which the Linux writeback pipeline issues +/// `sync_file_range` / `posix_fadvise(DONTNEED)` pairs. 32 MiB is the +/// historical default — bounded-cache pressure stays at ~2 × this size. +const WRITEBACK_CHUNK_BYTES: u64 = 32 * 1024 * 1024; /// Maximum bytes outstanding in the muxer → writer-thread ring. Sized /// to cover ~4 s of muxer output at a 32 MB/s peak — enough to absorb a