From: Julian Sun <sunjunchao@bytedance.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk,
brauner@kernel.org, mjguzik@gmail.com
Subject: Re: [External] Re: [PATCH v2 2/2] writeback: Add logging for slow writeback (exceeds sysctl_hung_task_timeout_secs)
Date: Tue, 30 Sep 2025 14:24:30 +0800 [thread overview]
Message-ID: <CAHSKhtf3F2CCU088EgAzrK_mg5GPgpuRuait6fwS-yHsx=hwng@mail.gmail.com> (raw)
In-Reply-To: <ehjjehcopkhidopj676n5hl2etdsl6lxdhgzhsz2f3rgfaxtwd@cqgb6xry3jho>
On Mon, Sep 29, 2025 at 11:51 PM Jan Kara <jack@suse.cz> wrote:
>
> On Mon 29-09-25 20:28:50, Julian Sun wrote:
> > When a writeback work lasts for sysctl_hung_task_timeout_secs, we want
> > to identify that it's slow-this helps us pinpoint potential issues.
> >
> > Additionally, recording the starting jiffies is useful when debugging a
> > crashed vmcore.
> >
> > Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
>
> So this works but I'd rather do:
>
> > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> > index 61785a9d6669..131d0d11672b 100644
> > --- a/fs/fs-writeback.c
> > +++ b/fs/fs-writeback.c
> > @@ -213,6 +213,7 @@ static void wb_queue_work(struct bdi_writeback *wb,
> > */
> > void wb_wait_for_completion(struct wb_completion *done)
> > {
> > + done->wait_stamp = jiffies;
> > atomic_dec(&done->cnt); /* put down the initial count */
> > wait_event(*done->waitq,
> > ({ done->progress_stamp = jiffies; !atomic_read(&done->cnt); }));
>
> static bool wb_wait_for_completion_cb(struct wb_completion *done,
> unsigned long wait_start)
> {
> done->progress_stamp = jiffies;
> if ((jiffies - wait_start) / HZ > sysctl_hung_task_timeout_secs)
> pr_info(dump here kind of hang check warning);
>
> return !atomic_read(&done->cnt);
> }
>
> void wb_wait_for_completion(struct wb_completion *done)
> {
> unsigned long wait_start = jiffies;
>
> atomic_dec(&done->cnt); /* put down the initial count */
> wait_event(*done->waitq, wb_wait_for_completion_cb(done, wait_start));
> }
>
> This way we can properly dump info about blocked task which is IMO more
> interesting than info about BDI.
Indeed, this makes more sense. Thank you for your suggestion.
>
> Honza
>
> --
> Jan Kara <jack@suse.com>
> SUSE Labs, CR
--
Julian Sun <sunjunchao@bytedance.com>
next prev parent reply other threads:[~2025-09-30 6:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-29 12:28 [PATCH v2 1/2] writeback: Wake up waiting tasks when finishing the writeback of a chunk Julian Sun
2025-09-29 12:28 ` [PATCH v2 2/2] writeback: Add logging for slow writeback (exceeds sysctl_hung_task_timeout_secs) Julian Sun
2025-09-29 15:50 ` Jan Kara
2025-09-30 6:24 ` Julian Sun [this message]
2025-09-29 15:21 ` [PATCH v2 1/2] writeback: Wake up waiting tasks when finishing the writeback of a chunk Jan Kara
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='CAHSKhtf3F2CCU088EgAzrK_mg5GPgpuRuait6fwS-yHsx=hwng@mail.gmail.com' \
--to=sunjunchao@bytedance.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mjguzik@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).