From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,willy@infradead.org,stable@vger.kernel.org,jack@suse.cz,hch@lst.de,hannes@cmpxchg.org,joannelkoong@gmail.com,akpm@linux-foundation.org
Subject: [merged mm-hotfixes-stable] mm-reinstate-unconditional-writeback-start-in-balance_dirty_pages.patch removed from -mm tree
Date: Mon, 06 Apr 2026 11:14:20 -0700 [thread overview]
Message-ID: <20260406181420.A3A5CC4CEF7@smtp.kernel.org> (raw)
The quilt patch titled
Subject: mm: reinstate unconditional writeback start in balance_dirty_pages()
has been removed from the -mm tree. Its filename was
mm-reinstate-unconditional-writeback-start-in-balance_dirty_pages.patch
This patch was dropped because it was merged into the mm-hotfixes-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Joanne Koong <joannelkoong@gmail.com>
Subject: mm: reinstate unconditional writeback start in balance_dirty_pages()
Date: Thu, 26 Mar 2026 14:51:27 -0700
Commit 64dd89ae01f2 ("mm/block/fs: remove laptop_mode") removed this
unconditional writeback start from balance_dirty_pages():
if (unlikely(!writeback_in_progress(wb)))
wb_start_background_writeback(wb);
This logic needs to be reinstated to prevent performance regressions for
strictlimited BDIs and memcg setups. The problem occurs because:
a) For strictlimited BDIs, throttling is calculated using per-wb
thresholds. The per-wb threshold can be exceeded even when the global
dirty threshold was not exceeded (nr_dirty < gdtc->bg_thresh)
b) For memcg-based throttling, memcg uses its own dirty count /
thresholds and can trigger throttling even when the global threshold
isn't exceeded
Without the unconditional writeback start, IO is throttled as it waits for
dirty pages to be written back but there is no writeback running. This
leads to severe stalls. On fuse, buffered write performance dropped from
1400 MiB/s to 2000 KiB/s.
Reinstate the unconditional writeback start so that writeback is
guaranteed to be running whenever IO needs to be throttled.
Link: https://lkml.kernel.org/r/20260326215127.3857682-2-joannelkoong@gmail.com
Fixes: 64dd89ae01f2 ("mm/block/fs: remove laptop_mode")
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/page-writeback.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
--- a/mm/page-writeback.c~mm-reinstate-unconditional-writeback-start-in-balance_dirty_pages
+++ a/mm/page-writeback.c
@@ -1858,6 +1858,27 @@ free_running:
break;
}
+ /*
+ * Unconditionally start background writeback if it's not
+ * already in progress. We need to do this because the global
+ * dirty threshold check above (nr_dirty > gdtc->bg_thresh)
+ * doesn't account for these cases:
+ *
+ * a) strictlimit BDIs: throttling is calculated using per-wb
+ * thresholds. The per-wb threshold can be exceeded even when
+ * nr_dirty < gdtc->bg_thresh
+ *
+ * b) memcg-based throttling: memcg uses its own dirty count and
+ * thresholds and can trigger throttling even when global
+ * nr_dirty < gdtc->bg_thresh
+ *
+ * Writeback needs to be started else the writer stalls in the
+ * throttle loop waiting for dirty pages to be written back
+ * while no writeback is running.
+ */
+ if (unlikely(!writeback_in_progress(wb)))
+ wb_start_background_writeback(wb);
+
mem_cgroup_flush_foreign(wb);
/*
_
Patches currently in -mm which might be from joannelkoong@gmail.com are
mm-start-background-writeback-based-on-per-wb-threshold-for-strictlimit-bdis.patch
reply other threads:[~2026-04-06 18:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260406181420.A3A5CC4CEF7@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=joannelkoong@gmail.com \
--cc=mm-commits@vger.kernel.org \
--cc=stable@vger.kernel.org \
--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