[PATCH v2 0/4] writeback: make slow writeback report more actionable

Breno Leitao posted 4 patches 1 week, 6 days ago
fs/fs-writeback.c           | 40 ++++++++++++++++++++++++++++------------
include/linux/backing-dev.h |  3 ++-
mm/memcontrol.c             |  2 +-
3 files changed, 31 insertions(+), 14 deletions(-)
[PATCH v2 0/4] writeback: make slow writeback report more actionable
Posted by Breno Leitao 1 week, 6 days ago
Since v6.19, writeback waiters are woken while their writeback makes
progress, so a slow sync no longer trips the hung task detector.
Instead, a waiter past hung_task_timeout_secs logs:

  INFO: The task sync:180 has been waiting for writeback completion for more than 28 seconds.

Across the Meta fleet, this line is logged about 19,000 times a day
(the median over 40 days), and up to 82,000 times on a busy day.

Over one day, 194 hosts logged 16,858 of these lines for only about
2,000 waits, half of them longer than 160 seconds. Most reports were
printed twice, and a wait logged a median of 7 lines.

Going through these reports, a few things made them hard to use and
quickly act on:

1. The message has no trailing newline, so it only shows up once the
   next message is logged. Patch 1 fixes that, for stable.
2. It does not say which device is slow. Patch 2 adds the bdi and the
   number of work items left.
3. The end of the wait is logged as one more "has been waiting" line.
   Patch 3 logs the total wait instead.
4. It is printed every half timeout, often twice. Patch 4 wakes the
   waiter and prints it once per timeout.

With the series, a sync of files dirtied from two cgroups, on a null_blk
device throttled to 4 MB/s and with hung_task_timeout_secs set to 5,
logs:

  [    9.262814] INFO: The task sync:276 has been waiting for writeback completion for more than 5 seconds (bdi 252:0, work items left: 2).
  [   14.683024] INFO: The task sync:276 has been waiting for writeback completion for more than 10 seconds (bdi 252:0, work items left: 2).
  [   20.103027] INFO: The task sync:276 has been waiting for writeback completion for more than 16 seconds (bdi 252:0, work items left: 2).
  [   25.222884] INFO: The task sync:276 has been waiting for writeback completion for more than 21 seconds (bdi 252:0, work items left: 2).
  [   30.542836] INFO: The task sync:276 has been waiting for writeback completion for more than 26 seconds (bdi 252:0, work items left: 2).
  [   33.562975] The task sync:276 waited 29 seconds for writeback completion on bdi 252:0

Without patch 4, the same test logs 18 reports.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
Changes in v2:
- Print the bdi and the work items left on the report line itself (Jan)
- Patch 4: wake the waiter once per timeout instead of adding
  report_stamp (Jan); its changelog shows the hung task warnings that
  this can bring back
- Patch 4: the doubled reports come from wait_event() checking the
  condition twice per wakeup, not from the two flushers
- Collect Jan's Reviewed-by on patches 1 and 3 (patch 3 rebased on the
  one-line report)
- Link to v1: https://patch.msgid.link/20261106-writeback_stall_report-v1-0-bf0c3b9023a5@debian.org

---
Breno Leitao (4):
      writeback: add the missing newline to the slow writeback report
      writeback: name the bdi in the slow writeback report
      writeback: log the end of a slow writeback wait
      writeback: report a slow writeback wait once per timeout

 fs/fs-writeback.c           | 40 ++++++++++++++++++++++++++++------------
 include/linux/backing-dev.h |  3 ++-
 mm/memcontrol.c             |  2 +-
 3 files changed, 31 insertions(+), 14 deletions(-)
---
base-commit: 8b7179210b22f8e48a82c5ceacb9d56a9c4cfec4
change-id: 20261105-writeback_stall_report-170750a69946

Best regards,
--  
Breno Leitao <leitao@debian.org>
Re: (subset) [PATCH v2 0/4] writeback: make slow writeback report more actionable
Posted by Christian Brauner 5 days, 15 hours ago
On Tue, 10 Nov 2026 03:39:26 -0800, Breno Leitao wrote:
> Since v6.19, writeback waiters are woken while their writeback makes
> progress, so a slow sync no longer trips the hung task detector.
> Instead, a waiter past hung_task_timeout_secs logs:
> 
>   INFO: The task sync:180 has been waiting for writeback completion for more than 28 seconds.
> 
> Across the Meta fleet, this line is logged about 19,000 times a day
> (the median over 40 days), and up to 82,000 times on a busy day.
> 
> [...]

I took 1-3 as they're fairly separate fixes. Please rework 4 as agreed on the
thread and send it.

---

Applied to the vfs-7.5.writeback branch of the vfs/vfs.git tree.
Patches in the vfs-7.5.writeback branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.5.writeback

[1/4] writeback: add the missing newline to the slow writeback report
      https://git.kernel.org/vfs/vfs/c/82da6ca38c26
[2/4] writeback: name the bdi in the slow writeback report
      https://git.kernel.org/vfs/vfs/c/8dd5775aab52
[3/4] writeback: log the end of a slow writeback wait
      https://git.kernel.org/vfs/vfs/c/26286f60c266