[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAhV-H5pj9zZ4EmJHqf3G8mQBnLNbt6AG+rt0c=bZJsaTx782g@mail.gmail.com>
Date: Tue, 3 Feb 2026 17:16:46 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Jan Kara <jack@...e.cz>
Cc: Huacai Chen <chenhuacai@...ngson.cn>, Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, linux-fsdevel@...r.kernel.org,
Xuefeng Li <lixuefeng@...ngson.cn>, Julian Sun <sunjunchao@...edance.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] writeback: Fix wakeup and logging timeouts for !DETECT_HUNG_TASK
On Tue, Feb 3, 2026 at 5:08 PM Jan Kara <jack@...e.cz> wrote:
>
> On Tue 03-02-26 14:30:23, Huacai Chen wrote:
> > Recent changes of fs-writeback cause such warnings if DETECT_HUNG_TASK
> > is not enabled:
> >
> > INFO: The task sync:1342 has been waiting for writeback completion for more than 1 seconds.
> >
> > The reason is sysctl_hung_task_timeout_secs is 0 when DETECT_HUNG_TASK
> > is not enabled, then it causes the warning message even if the writeback
> > lasts for only one second.
> >
> > So guard the wakeup and logging with "#ifdef CONFIG_DETECT_HUNG_TASK",
> > so as to eliminate the warning messages.
> >
> > Fixes: 1888635532fb ("writeback: Wake up waiting tasks when finishing the writeback of a chunk.")
> > Fixes: d6e621590764 ("writeback: Add logging for slow writeback (exceeds sysctl_hung_task_timeout_secs)")
> > Signed-off-by: Huacai Chen <chenhuacai@...ngson.cn>
>
> Thanks! Looks good to me. Feel free to add:
>
> Reviewed-by: Jan Kara <jack@...e.cz>
Thanks, but don't apply because I found that
sysctl_hung_task_timeout_secs can also be 0 for DETECT_HUNG_TASK.
Please wait for V3.
Huacai
>
> Honza
>
> > ---
> > V2: Disable wakeup and logging for !DETECT_HUNG_TASK.
> >
> > fs/fs-writeback.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> > index 5444fc706ac7..bfe469fff97c 100644
> > --- a/fs/fs-writeback.c
> > +++ b/fs/fs-writeback.c
> > @@ -198,13 +198,15 @@ static void wb_queue_work(struct bdi_writeback *wb,
> >
> > static bool wb_wait_for_completion_cb(struct wb_completion *done)
> > {
> > +#ifdef CONFIG_DETECT_HUNG_TASK
> > unsigned long waited_secs = (jiffies - done->wait_start) / HZ;
> >
> > - done->progress_stamp = jiffies;
> > if (waited_secs > sysctl_hung_task_timeout_secs)
> > pr_info("INFO: The task %s:%d has been waiting for writeback "
> > "completion for more than %lu seconds.",
> > current->comm, current->pid, waited_secs);
> > +#endif
> > + done->progress_stamp = jiffies;
> >
> > return !atomic_read(&done->cnt);
> > }
> > @@ -2029,11 +2031,13 @@ static long writeback_sb_inodes(struct super_block *sb,
> > */
> > __writeback_single_inode(inode, &wbc);
> >
> > +#ifdef CONFIG_DETECT_HUNG_TASK
> > /* Report progress to inform the hung task detector of the progress. */
> > if (work->done && work->done->progress_stamp &&
> > (jiffies - work->done->progress_stamp) > HZ *
> > sysctl_hung_task_timeout_secs / 2)
> > wake_up_all(work->done->waitq);
> > +#endif
> >
> > wbc_detach_inode(&wbc);
> > work->nr_pages -= write_chunk - wbc.nr_to_write;
> > --
> > 2.47.3
> >
> --
> Jan Kara <jack@...e.com>
> SUSE Labs, CR
Powered by blists - more mailing lists