Re: [PATCH v2 3/5] f2fs: cache: wake up f2fs_writeback when exceeding threshold
From: Wenjie Qi
Date: Fri Oct 09 2026 - 06:16:13 EST
Hi Chao,
> + if (dirty_threshold && nr_dirty < dirty_threshold)
> + return false;
> +
> + /* don't wake up f2fs_writeback if both thresholds are zero */
> + return total_threshold || dirty_threshold;
There is a related case with only the total threshold enabled. With
cache_wb_dirty_threshold=0 and cache_wb_total_threshold=1, clean cached
entries keep the predicate true even when there are no dirty meta/node
caches. Writeback does not necessarily evict those entries, so the
thread can keep looping without sleeping.
I checked this in QEMU using dev-test plus my both-zero fix, which has
the same predicate for these fixed threshold values. In a three-second
idle interval, the writeback thread used about three CPU seconds;
the total cache count was 22 and the dirty count was zero at both
sample points.
Should the thread wait when no dirty caches remain, even if the total
threshold is still met, or is different behavior intended for this mode?
Best regards,
Wenjie