From: Avi Weiss <thnkslprpt@gmail.com>
To: willy@infradead.org, jack@suse.cz, akpm@linux-foundation.org,
joannelkoong@gmail.com
Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, Avi Weiss <thnkslprpt@gmail.com>
Subject: [PATCH v2] mm/page-writeback: avoid unnecessary strictlimit background wakeups
Date: Sun, 8 Nov 2026 10:54:57 +0200 [thread overview]
Message-ID: <20261108085456.2093096-2-thnkslprpt@gmail.com> (raw)
balance_dirty_pages() includes pages under writeback in
gdtc->wb_dirty when checking the per-wb background threshold for
strictlimit BDIs. However, wb_over_bg_thresh() only considers
reclaimable dirty pages when deciding whether to start more
background writeback.
This can repeatedly wake the background worker even when there are
too few dirty pages to write. In a 15-second FUSE writeback test,
background wakeup requests dropped from 2657 to 682 (74% drop),
while writeback_start events remained nearly unchanged at 99 and 98.
Check wb_over_bg_thresh() before starting background writeback through
the strictlimit condition. Leave the global background threshold
check and the wakeup required for dirty throttling unchanged.
Fixes: 0437906841d0 ("mm: start background writeback based on per-wb threshold for strictlimit BDIs")
Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
v2:
- explain the preliminary strictlimit threshold check
v1: https://lore.kernel.org/r/20261031070515.3042848-2-thnkslprpt@gmail.com
mm/page-writeback.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 499a35473e4f..0529b4a7e99c 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1824,9 +1824,15 @@ static int balance_dirty_pages(struct bdi_writeback *wb,
balance_domain_limits(mdtc, strictlimit);
}
+ /*
+ * gdtc->wb_dirty includes pages under writeback, so use it as
+ * a cheap preliminary check before wb_over_bg_thresh() decides
+ * whether background writeback is needed.
+ */
if (!writeback_in_progress(wb) &&
(nr_dirty > gdtc->bg_thresh ||
- (strictlimit && gdtc->wb_dirty > gdtc->wb_bg_thresh)))
+ (strictlimit && gdtc->wb_dirty > gdtc->wb_bg_thresh &&
+ wb_over_bg_thresh(wb))))
wb_start_background_writeback(wb);
/*
base-commit: 36aad21d50d1af3f6954bb0c988257a908202477
--
2.43.0
reply other threads:[~2026-11-08 8:55 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=20261108085456.2093096-2-thnkslprpt@gmail.com \
--to=thnkslprpt@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=jack@suse.cz \
--cc=joannelkoong@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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
all inboxes | Powered by JetHome®