From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD32D1D5CEA for ; Mon, 2 Feb 2026 02:27:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769999279; cv=none; b=UgSl5RSfc2JjRtb02RV4C9X9a+V38XjyNT9ODqQcWZx0cmUml6GH1ElZGE3ICu+TggPVv6r38l18+JzgiW6+setOSewooctX7Q4nz8NHxQehxHKuCFYtdAhSW8/fu1uyY4yDWx+GutsGVCXSm6vouQjZZmbFZZFWP+pB7FEizAk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769999279; c=relaxed/simple; bh=c18aY+u6puIMVPmuCxKY+tqBdy/i964ilbAn+cS1m8g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=paJbgPkgxZ32SFyamKLgryhtmS6C2opfVIFKocbNdTjFGnCL1NtKeRrVsSu2W0dstNapoQtIYC1CsoSTfM7duuPUxvcyAjJQ7f4PA9/fKgfdHOennTkYfDe1Xar1+YYNbOhdiWmtj/jbMTjPrYDkf6ymxfe9WSlhjM7ypqcySyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=D78dTBlj; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="D78dTBlj" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-352dda4a34eso1589807a91.1 for ; Sun, 01 Feb 2026 18:27:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1769999277; x=1770604077; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Ib1/7wDujkxaZJbA6XE/xuPmxkcPG0qS3D0QygAAiJo=; b=D78dTBljEP/laJiq2oBjhhl7MkCD4Yz418eE87w4eK4X3uvotIXTYkT75vbPqNwz58 QXHurnvF4kzvphwnPCoMmi75HkloUKJV29Wd1sIbIW8TJwQWVG2bUhhg/Bmf31OSP1Lj +BmXJpqY6AW+/Ewz7MPMOPP/8cIhkwcg/kA2bUFRYRmU+bB7Kye6+JwMOdvzeZFnqfQJ lL5eP4cG7CR0hXpgvjAV6St53AY9FwVQA3tzOIgLziKKXswQikSieZYCGeA2fMgvq+nS C5olY/JKQxm2R7nS68vK9zJryKyonqeox3YBu1GBC/woCVhgDUXrn4ouPo8QX/JXquFA p3OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769999277; x=1770604077; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Ib1/7wDujkxaZJbA6XE/xuPmxkcPG0qS3D0QygAAiJo=; b=htwnVnn8puV6I0hXp4onLZg1gPULrnlM7lUkGn6cVidGBpq49BvGY+tzjm/gMAqybi 255+1CkHPXO4Tb9Zv2EfxnXf00d3RD7+LUSCH8ib2jAbvDI66eseDrBLXn4rGtl9SMzP HQa2JXGqkn7rHtquJnAtey8b6wrMS6JjSHFUsD0gOo0PMq9ZimaCZXkAkIjYam+xWBDY UPZmlE8gqL37raUwA9GVX5y53qaf5B3cfFlVlXWHV4XVbl5d1mD45CC6D+XZ/T5HSCxc 37Hdlx0CmHDD2Pt+ORGeF5z6e8YRURG9eodUyUJk5WRWsWMolkUUWNVTjDd63X8MPlO/ 8DxA== X-Forwarded-Encrypted: i=1; AJvYcCWc+Qd1tnkS5rp3T6O65m9cQ/QfLPZ5zmtpYYga1GMy8qYu15N49CwEYcmQeyZwTgQcAl9DDb1cmibsyh0=@vger.kernel.org X-Gm-Message-State: AOJu0YxJqwftax9WYUD510vpSiDzCz/P4w98UDqTXMlryo5RAwC4Lb1X jH3Qz0+E0GwhQiv/N/phw4MdJ3GiykWR4WsQNgdlrnYt0CyG/4A87/1LwKzYAf+Oa84= X-Gm-Gg: AZuq6aKrjBxOKSFkrlCzFeusrEI2g5Z8+nqaBTq5UsboWePJHlEuz/8YXsHElpKULTU 18pJUv8LQcZNm/o/dvnRmBsrc+ddJOAUpl6rHiR2KoImHjy+XMx1Bpduki3VFLXzrQ11GRdsXpW DQ6QLyavWa2haDtzkfIo8qkFKjR4p9o9xN+Ec2TGvc5hAi4InBB/Z1eMs7B+pVYt3UGnoBwUtH4 6/L5fsrVgKyGIjsSLqE8o6NqsVBVaqyqhfWZVZUqqIEwoEH9GNYbF33WB0Ez2VZQaeiSv289iiK CCdbFW/BHPaSVSnVX6d1Rs4Go/iYlq2sYYeoHPvkm/Y6975PP0VU53GDffnuSNQT1EE69AZ0Sj6 CCTSdY/HF4UYFAjFu4AwB/1h73uWpDH7Bp2eUWpOjgICni6MlZhL5ZO6EIgzATwpl9G75Q0Z9Ul I8GTBDoL6HvECeNrA8Cblh8QsXYM7h+kJIc68= X-Received: by 2002:a17:90a:d886:b0:341:88c9:ca62 with SMTP id 98e67ed59e1d1-3543b3d120fmr8851545a91.31.1769999276970; Sun, 01 Feb 2026 18:27:56 -0800 (PST) Received: from [10.254.198.225] ([139.177.225.253]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3543d73386asm3333466a91.14.2026.02.01.18.27.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Feb 2026 18:27:56 -0800 (PST) Message-ID: <2538bda2-e14a-4ae0-a32d-e944ca44b37f@bytedance.com> Date: Mon, 2 Feb 2026 10:27:50 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] writeback: Fix wakeup and logging timeouts for !DETECT_HUNG_TASK To: Huacai Chen , Huacai Chen , Alexander Viro , Christian Brauner Cc: Jan Kara , linux-fsdevel@vger.kernel.org, Xuefeng Li , linux-kernel@vger.kernel.org References: <20260131090724.4128443-1-chenhuacai@loongson.cn> From: Julian Sun In-Reply-To: <20260131090724.4128443-1-chenhuacai@loongson.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/31/26 5:07 PM, 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. > > I believe the wakeup and logging is also useful for !DETECT_HUNG_TASK, > so I don't want to disable them completely. As DEFAULT_HUNG_TASK_TIMEOUT > is 120 seconds, so for the !DETECT_HUNG_TASK case let's use 120 seconds > instead of sysctl_hung_task_timeout_secs. > > 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 > --- > fs/fs-writeback.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c > index 5444fc706ac7..847e46f0e019 100644 > --- a/fs/fs-writeback.c > +++ b/fs/fs-writeback.c > @@ -198,10 +198,15 @@ static void wb_queue_work(struct bdi_writeback *wb, > > static bool wb_wait_for_completion_cb(struct wb_completion *done) > { > +#ifndef CONFIG_DETECT_HUNG_TASK > + unsigned long hung_secs = 120; > +#else > + unsigned long hung_secs = sysctl_hung_task_timeout_secs; > +#endif > unsigned long waited_secs = (jiffies - done->wait_start) / HZ; > > done->progress_stamp = jiffies; > - if (waited_secs > sysctl_hung_task_timeout_secs) > + if (waited_secs > hung_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); > @@ -1947,6 +1952,11 @@ static long writeback_sb_inodes(struct super_block *sb, > long write_chunk; > long total_wrote = 0; /* count both pages and inodes */ > unsigned long dirtied_before = jiffies; > +#ifndef CONFIG_DETECT_HUNG_TASK > + unsigned long hung_secs = 120; > +#else > + unsigned long hung_secs = sysctl_hung_task_timeout_secs; > +#endif > > if (work->for_kupdate) > dirtied_before = jiffies - > @@ -2031,8 +2041,7 @@ static long writeback_sb_inodes(struct super_block *sb, > > /* 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) > + (jiffies - work->done->progress_stamp) > HZ * hung_secs / 2) > wake_up_all(work->done->waitq); > > wbc_detach_inode(&wbc); Thanks for the patch, looks good to me. Reviewed-by: Julian Sun -- Julian Sun