From: Chao Yu <chao@kernel.org>
To: Wenjie Qi <qwjhust@gmail.com>
Cc: chao@kernel.org, jaegeuk@kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, qiwenjie@xiaomi.com
Subject: Re: [PATCH v2 3/5] f2fs: cache: wake up f2fs_writeback when exceeding threshold
Date: Mon, 12 Oct 2026 17:27:35 +0800 [thread overview]
Message-ID: <33508315-bf40-4c96-b77f-1a5001099d76@kernel.org> (raw)
In-Reply-To: <20261009101340.3525944-1-qiwenjie@xiaomi.com>
Hi Wenjie,
Thanks a lot for the review.
On 10/9/26 18:13, Wenjie Qi wrote:
> 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?
Thanks for the test, yes, it should wait. In v3, the thread won't be
woken up unless there are enough dirty caches for
f2fs_write_{meta,node}_caches() to gather (i.e. dirty count reaches
nr_caches_to_skip()), regardless of the total threshold. Also, threshold
based wakeup will be throttled once a round fails to write anything.
With your setting (dirty_threshold=0, total_threshold=1), I can see the
writeback thread uses 0.0% cpu in idle state, w/ either few or thousands
of clean cached entries, and w/ dirty caches below the threshold under
checkpoint=disable.
Thanks,
>
> Best regards,
> Wenjie
prev parent reply other threads:[~2026-10-12 9:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 9:18 Chao Yu
2026-10-09 10:13 ` Wenjie Qi
2026-10-12 9:27 ` Chao Yu [this message]
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=33508315-bf40-4c96-b77f-1a5001099d76@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=qiwenjie@xiaomi.com \
--cc=qwjhust@gmail.com \
/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®