mm/page-writeback: avoid unnecessary strictlimit background wakeups
Subsystems (3)
PATCH v2 1/1 mm/page-writeback: avoid unnecessary strictlimit background wakeups
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.
---
v2:
- explain the preliminary strictlimit threshold check
v1: https://lore.kernel.org/r/[email protected]
mm/page-writeback.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
mm/page-writeback.c +7 -1
@@ -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
Signature · 1 line
2.43.0