* [PATCH] f2fs: avoid cache writeback busy loop with zero thresholds
@ 2026-10-09 3:53 Wenjie Qi
2026-10-09 8:29 ` Chao Yu
0 siblings, 1 reply; 3+ messages in thread
From: Wenjie Qi @ 2026-10-09 3:53 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-f2fs-devel, linux-kernel, qiwenjie, qwjhust
When both cache writeback thresholds are zero,
f2fs_should_wake_up_cache_wb() returns true even with no dirty caches.
This makes wait_event_freezable_timeout() return immediately and the
writeback thread busy-loop instead of waiting for its periodic timeout.
Return false when both thresholds are disabled so periodic writeback
can proceed without busy-looping.
Fixes: d7f084b1ad93 ("f2fs: cache: wake up f2fs_writeback when exceeding threshold")
Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
---
Based on f2fs/dev-test at ce439a2b0690.
fs/f2fs/cache.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/cache.c b/fs/f2fs/cache.c
index c76c4660606c5..88d4e479c8469 100644
--- a/fs/f2fs/cache.c
+++ b/fs/f2fs/cache.c
@@ -740,7 +740,8 @@ static inline bool f2fs_should_wake_up_cache_wb(struct f2fs_sb_info *sbi)
nr_dirty < cache_thread->cache_wb_dirty_threshold)
return false;
- return true;
+ return cache_thread->cache_wb_total_threshold ||
+ cache_thread->cache_wb_dirty_threshold;
}
static int f2fs_cache_writeback_kthread(void *data)
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] f2fs: avoid cache writeback busy loop with zero thresholds
2026-10-09 3:53 [PATCH] f2fs: avoid cache writeback busy loop with zero thresholds Wenjie Qi
@ 2026-10-09 8:29 ` Chao Yu
2026-10-09 8:44 ` Wenjie Qi
0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2026-10-09 8:29 UTC (permalink / raw)
To: Wenjie Qi, jaegeuk; +Cc: chao, linux-f2fs-devel, linux-kernel, qiwenjie
On 10/9/26 11:53, Wenjie Qi wrote:
> When both cache writeback thresholds are zero,
> f2fs_should_wake_up_cache_wb() returns true even with no dirty caches.
> This makes wait_event_freezable_timeout() return immediately and the
> writeback thread busy-loop instead of waiting for its periodic timeout.
>
> Return false when both thresholds are disabled so periodic writeback
> can proceed without busy-looping.
>
> Fixes: d7f084b1ad93 ("f2fs: cache: wake up f2fs_writeback when exceeding threshold")
> Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
> ---
> Based on f2fs/dev-test at ce439a2b0690.
>
> fs/f2fs/cache.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/cache.c b/fs/f2fs/cache.c
> index c76c4660606c5..88d4e479c8469 100644
> --- a/fs/f2fs/cache.c
> +++ b/fs/f2fs/cache.c
> @@ -740,7 +740,8 @@ static inline bool f2fs_should_wake_up_cache_wb(struct f2fs_sb_info *sbi)
> nr_dirty < cache_thread->cache_wb_dirty_threshold)
> return false;
>
> - return true;
> + return cache_thread->cache_wb_total_threshold ||
> + cache_thread->cache_wb_dirty_threshold;
Thanks for the fix, do you mind I fold this into original patch? as it
is still in dev-test.
Thanks,
> }
>
> static int f2fs_cache_writeback_kthread(void *data)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] f2fs: avoid cache writeback busy loop with zero thresholds
2026-10-09 8:29 ` Chao Yu
@ 2026-10-09 8:44 ` Wenjie Qi
0 siblings, 0 replies; 3+ messages in thread
From: Wenjie Qi @ 2026-10-09 8:44 UTC (permalink / raw)
To: chao; +Cc: jaegeuk, linux-f2fs-devel, linux-kernel, qiwenjie, qwjhust
Hi Chao,
On Fri, Oct 9, 2026, Chao Yu wrote:
> Thanks for the fix, do you mind I fold this into original patch? as it
> is still in dev-test.
Yes, please fold it into the original patch.
Best regards,
Wenjie
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-09 8:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-09 3:53 [PATCH] f2fs: avoid cache writeback busy loop with zero thresholds Wenjie Qi
2026-10-09 8:29 ` Chao Yu
2026-10-09 8:44 ` Wenjie Qi
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®