From nobody Tue Nov 24 04:33:14 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=82.195.75.108 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793968077; b=KaNcdgfQrMC2iYxVZdKnshiptqqpiseBKAOiGRWIgOSc2IMbRckQYCCbEJW2hOmKiYGC xDsX18gVPb+SohwlNqGMZV14TXXNgfbdffd370vUN6ZOU4ooLprRDHan7XfAhGIlfyJVj iANhppLb3Nm2khpDXLgSOrR3yOAMNEQhS7pXdFZ9wgo4NWBAcXZtCogYK/2WkPCJysbRS N2FAc+5CCYahm9JDJHbSFGhyB7W60wqhuP9dn65ayGKi3cRXzzcVvVZ/aeLGWfSUuLlom Qd1KQqQPjbyEaEHzfLzuclKgPz79w8TNySowx1q9irRJ6ga9Y1s5If6T0UcyBk7Sx0A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793968077; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Debian-User; bh=jxg9YZCEig6aUovfMW9LERszjpC/Bi2+TpPnGTSoQi8=; b=UHQzGZ6Rx2kiioIUEc7LUscy+VdMhn15iMA4/eNUb6GudwpZgJlV5Ysfn1LAK6lTa4Bl pb2CId9Umhc8+x0kHsZX2qXwhFgfZxnxO7XxETGHrTIBz+BLhn/jbTjCJwnjrc6UJHCI4 QtZiFpt/d54KAvcDCMKztEyuAn3ZB9nFKWkE2KQsb53dW0VvWi/DQIIMmy2gKZyCfJD5g rVtX/DE/HkQa0s24VYcf6RrBQxLQdyJHV7sDvYS3kehS00dz6NIq+v3OvYSetzcqTKBGN jtQ4/Qlj0CdITf3IXC/D9BzljDHWt3xXrOLWfHsbPIJjMuNd6mo2M7zTvNVefkCg+jg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=vAKfrI77; arc=none smtp.remote-ip=82.195.75.108 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1546C606A329; Fri, 6 Nov 2026 12:27:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1546C606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=vAKfrI77 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=jxg9YZCEig6aUovfMW9LERszjpC/Bi2+TpPnGTSoQi8=; b=vAKfrI77DsSLod+Uczrvqv0Tjm ULrjeHLN2Rut6XqF70F/+op1bDdDobytns5RumRz1iCQtdGynoyR9fEa0SwQv6YpKI3SC8ykaUgY0 i/SWyGlqVkJ82lNhPWpd5emu+d8doJhm52qVWwqwPkOYijL9rLtf0ZHHkvWfBV55sJvtw9oSMrAcX Rtumffo1xchJf9z5Nh0Ss8d9fZ/Z2vBLbPOKULbbkIjM/mgkT8VSEgE9LtRU+FZP8uSpX5JuCjQwi jDC0KLUFA3h4s32VBKUrZVWcjW9Xm9be30Kv0pm+ik9KStMV3cJOIUkesKqNHuFr+1cvcdm6HUCxR 9x7JgBMQ==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1xPJ2i-009HTo-2N; Fri, 06 Nov 2026 12:27:40 +0000 From: Breno Leitao Date: Fri, 06 Nov 2026 04:26:31 -0800 Subject: [PATCH 1/4] writeback: add the missing newline to the slow writeback report X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261106-writeback_stall_report-v1-1-bf0c3b9023a5@debian.org> References: <20261106-writeback_stall_report-v1-0-bf0c3b9023a5@debian.org> In-Reply-To: <20261106-writeback_stall_report-v1-0-bf0c3b9023a5@debian.org> To: Alexander Viro , Christian Brauner , Jan Kara , Julian Sun , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Breno Leitao , kernel-team@meta.com, stable@vger.kernel.org X-Mailer: b4 0.17-dev-ce4c1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1200; i=leitao@debian.org; h=from:subject:message-id; bh=hXkUpm8Ppkso7pz3WNB+6bMAnx3JDLSgoZdBoLm0PN0=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBq7cexSsgObTcm99v2R6oLzUKT4iRNgAWjgc1wj fhbzzMWk4aJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCau3HsQAKCRA1o5Of/Hh3 bakDD/9OwZnPzwEaVdOCOEdmjSKRtZ3e3IIMxvSigJAkuxtCwyzcXS0/DwG/czZOVV0qUdveZs1 13hwg4K5H65DpmE5q65wdYsoBQTaaYML5y4m+wgJLeBgAWF9lPikmN5lK5BbFDRPsoxJK7zOR97 CH9UzLEICJChYXSSEKZUO+JTsFpHoJ/ZqLB65xjW14vnQioYxDjfQXcDguoe/H5hHKzp7i3Y91x 4jrdnA4AytGZRHzLYFZUsSbufyR49hLdd0jZ39cum0od09Clc5rU6kBTqC49ew9Pcxe9924vrya 4ONFnDU70eSshiysy7FDIOYE53Jy/liUfU+HXGGjk+SyKC3hJmJCCpzY0fyVefXTronP3feUbgf DMKOJg82Fnmy4jaLsc0UcajiWoXjEG9Vd3T9zUaoeqS0jHWDhhqstaSvraMdIQv+rEfULG5gWaa BCP3bJujtqpJof0ZMTbAuXcEcCf61lJlDmlCNgramOPSwxPETG5XbpyCEmXIMPGFToT13MbsXDQ w4gXLXe+kpiPQI2ODrOoTqlbikoAQ5Tns/dr2lAIb00cHHRuTYszNX0v9PFVCFmcPqbW7jYJx8r G/TsCjvSmEkAQLO8nP8wTDiY5OkUHoG2/lq4njN+OJD6l1fiYjNL7s1/VfTxh86INnx8pOusu15 /ZmM5yj+D7ZKFYg== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao wb_wait_for_completion_cb() reports a writeback wait that exceeds hung_task_timeout_secs with a pr_info() that has no trailing newline. printk() keeps such a record open for a continuation and does not finalize it, so dmesg, the consoles and netconsole only see the report once the next message is logged. Terminate the message with a newline. Fixes: d6e621590764 ("writeback: Add logging for slow writeback (exceeds sy= sctl_hung_task_timeout_secs)") Cc: stable@vger.kernel.org Signed-off-by: Breno Leitao Reviewed-by: Jan Kara --- fs/fs-writeback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 15260cf2a29b09..01a00d7542b371 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -204,7 +204,7 @@ static bool wb_wait_for_completion_cb(struct wb_complet= ion *done) done->progress_stamp =3D jiffies; if (timeout && (waited_secs > timeout)) pr_info("INFO: The task %s:%d has been waiting for writeback " - "completion for more than %lu seconds.", + "completion for more than %lu seconds.\n", current->comm, current->pid, waited_secs); =20 return !atomic_read(&done->cnt); --=20 2.53.0-Meta From nobody Tue Nov 24 04:33:14 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=82.195.75.108 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793968079; b=hs5kE16lJ4QIiMpIpmkxgDGlGkjt9g1wjE8x64IF1/xjwwJEIiMu62e7BTthOAVhJIVG HuoEfxNKhrcEPoHviMNtij3mHv4J+ii6UEu1RRST5082eo2896xSmYbMSI6NDXpXysxDp VDIu5P+Shk3TWHCKlg+3i1lBNF3kUCTWdxKZrM0wrTP6/FBlVXZ0fFH9dai32z7fF8F6k JSOuzIHYlEjB1ziCmEtxC9uKgJNJ/cuw7LXJRjwzYD/dMlIU0uZ5x7o+WYEXKeV8TzbFk TdRZeORJuO4ROqtd9MMMpVTAPZ37Kg36QcKsNJi2ZVLtJ+q3/6ibvzjwi4T2f1weoSQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793968079; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Debian-User; bh=0K0z0yTceTksPqIamPM3k9tvhF76ci83nLwd5+1KHsQ=; b=I/SemGXNl/kwFO8c6SZoa1QCLnNPrai8okAAi8PwcSWtZLMMwXqFpptDNvXEp67oyDiD AjCCgBcGJTznQozocWoPoksJHi2dgFJEHvJ9VyQf9TEY7myFA7m9DSqwlcnxqhewhAHk9 RP6NRcjIMUl1BiufRXwS8kH3vMjDp08abkmA2saeq/hODAeHSWpRsY4POwhhP6/osK8HE IDcGFo/eUdyiOYXLpmLEJ3xg97ltR5b9gWP6ELGrab0NQeRr/lR6ddM4y+omixechI+T+ dqGxDo2ZNcBDe9BTTM1yPzR+XNnrxwkDYLiwcLowv/H8pPCfrvOvP0ok3Pt/vnYYHCw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=Lz18xgjT; arc=none smtp.remote-ip=82.195.75.108 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65BA3606D801; Fri, 6 Nov 2026 12:27:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 65BA3606D801 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=Lz18xgjT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=0K0z0yTceTksPqIamPM3k9tvhF76ci83nLwd5+1KHsQ=; b=Lz18xgjTW3Eh2aHokixjfUhLYn sHr5VrLzB26C2/gOGJRnkURgsccY/mjIAN2CRGMpBPifNXnD7Da24Z6fpRFePA+KA02Ns9/yLDcVF 2MqcwCN3mgS6+JHkHJk7egJDedXHFVmyWe+sGGcyM7CArpvW8L23m5GNKuaT9J0hyO7RQU317YkE8 1udLIzUOkygs6zXojidQRGE+46sK6b2s38FreI6PAxLSqx0RI0sxxnc3y1NjECNR6NUbGf3mx40cK ferojonEagaetim6BeonRxtuXJSTjPy3GwC35zYj7HXuun8orkM0iI6VGmo76edkVzilm5KjjtFpj xvYv6Rww==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1xPJ2o-009HTw-0F; Fri, 06 Nov 2026 12:27:46 +0000 From: Breno Leitao Date: Fri, 06 Nov 2026 04:26:32 -0800 Subject: [PATCH 2/4] writeback: name the bdi in the slow writeback report X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261106-writeback_stall_report-v1-2-bf0c3b9023a5@debian.org> References: <20261106-writeback_stall_report-v1-0-bf0c3b9023a5@debian.org> In-Reply-To: <20261106-writeback_stall_report-v1-0-bf0c3b9023a5@debian.org> To: Alexander Viro , Christian Brauner , Jan Kara , Julian Sun , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.17-dev-ce4c1 X-Developer-Signature: v=1; a=openpgp-sha256; l=5387; i=leitao@debian.org; h=from:subject:message-id; bh=vGPPzg1eXn3iHlKOFVYXRKo9IwFuhJPYRhoA+zYRKhY=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBq7cexJKO2ZNZa6uneAZzk/9PkGTt4+gcQMjO9d sjqxOz84Q2JAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCau3HsQAKCRA1o5Of/Hh3 ba0mEACb2ydFMss9vayqjlC4o0sYYVPjf/oQTk01jLCDvdcx/IcMETO5xiJO8Uc6U3qXefvYCyT PoqH0YU+biQqdkC+avIMnMEE3Mav3MTIsbNvv/xgn/4dF316MQRfoEbY2rmMVr2/fPCQihc6gFt Ak7231toocCUeA0RaydMw90EaqDqOhSYtUb2GmFwtKRGTounUAkQ46DZzjCaPCOM5uhO8aUgCVR GXo9SQpomJqb91/20gJXd00YH73uYfk/DlRD7CW0xUb8QW6CpyXOE8wZToWnzHSuCOf07AULN11 9SrT5RXEBJ/mi9O7LqSgiTj2gx3ZLViw1r6yoQcZI26VjrtqJZI/kKRGlr+1yzv8UuiHRrxVoHN F2g+kX8HNGRP+Y28e8sN1ktjICQ1Ww+x4bIE//mYdSsVOg9A8qB+Bb4EnkZIrwyruP3gUXVp/qF F7hlcqSnzNfLJgVlfWhVRMdiLhlvx9b3cwRa2KLq0wXZnk1nazMkgnquobNVVgDpKWifmnnMKIZ wgHTd/OoQZt9g+YoD1W1I9pFWt3iuCzS2MAg8/DW8W7yCkt6vHO77wPZcWT3tZNWH+4k9XkpoKV jzR2dwJQMudeDpBjMXz9ZNoUMZnOB75a0QG/8oIPVFAzOvTSBVY9UwQkbdw5HhdNQRRmADcyuRT qlhip55y+TPZnXg== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao The slow writeback report names the waiting task and how long it has waited, but not what it is waiting on. On a machine with several filesystems there is no way to tell which device is slow. Pass the bdi to wb_wait_for_completion() and print its name on a second line, together with the number of work items still outstanding. A sync issues one work item per cgroup wb with dirty inodes, so the count also shows whether a single cgroup is holding up the others. wb_wait_for_completion() took the bdi until commit 5b9cce4c7eb0 ("writeback: Generalize and expose wb_completion") made it usable for the memcg foreign flushes. memcg tracks those by bdi id only and passes NULL, which bdi_dev_name() prints as "(unknown)". The first line does not change, so anything matching on it keeps working. A sync on a throttled null_blk device now reports: INFO: The task sync:180 has been waiting for writeback completion for mor= e than 28 seconds. bdi 252:0, work items left: 1 Signed-off-by: Breno Leitao --- fs/fs-writeback.c | 20 +++++++++++++------- include/linux/backing-dev.h | 3 ++- mm/memcontrol.c | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 01a00d7542b371..3dee9d65eaf721 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -196,16 +196,20 @@ static void wb_queue_work(struct bdi_writeback *wb, spin_unlock_irq(&wb->work_lock); } =20 -static bool wb_wait_for_completion_cb(struct wb_completion *done) +static bool wb_wait_for_completion_cb(struct wb_completion *done, + struct backing_dev_info *bdi) { unsigned long timeout =3D sysctl_hung_task_timeout_secs; unsigned long waited_secs =3D (jiffies - done->wait_start) / HZ; =20 done->progress_stamp =3D jiffies; - if (timeout && (waited_secs > timeout)) + if (timeout && (waited_secs > timeout)) { pr_info("INFO: The task %s:%d has been waiting for writeback " "completion for more than %lu seconds.\n", current->comm, current->pid, waited_secs); + pr_info(" bdi %s, work items left: %d\n", + bdi_dev_name(bdi), atomic_read(&done->cnt)); + } =20 return !atomic_read(&done->cnt); } @@ -213,6 +217,7 @@ static bool wb_wait_for_completion_cb(struct wb_complet= ion *done) /** * wb_wait_for_completion - wait for completion of bdi_writeback_works * @done: target wb_completion + * @bdi: bdi work items were issued to, NULL for the memcg foreign flushes * * Wait for one or more work items issued to @bdi with their ->done field * set to @done, which should have been initialized with @@ -220,11 +225,12 @@ static bool wb_wait_for_completion_cb(struct wb_compl= etion *done) * are completed. Work items which are waited upon aren't freed * automatically on completion. */ -void wb_wait_for_completion(struct wb_completion *done) +void wb_wait_for_completion(struct wb_completion *done, + struct backing_dev_info *bdi) { done->wait_start =3D jiffies; atomic_dec(&done->cnt); /* put down the initial count */ - wait_event(*done->waitq, wb_wait_for_completion_cb(done)); + wait_event(*done->waitq, wb_wait_for_completion_cb(done, bdi)); } =20 #ifdef CONFIG_CGROUP_WRITEBACK @@ -1164,7 +1170,7 @@ static void bdi_split_work_to_wbs(struct backing_dev_= info *bdi, last_wb =3D wb; =20 rcu_read_unlock(); - wb_wait_for_completion(&fallback_work_done); + wb_wait_for_completion(&fallback_work_done, bdi); goto restart; } rcu_read_unlock(); @@ -2972,7 +2978,7 @@ static void __writeback_inodes_sb_nr(struct super_blo= ck *sb, unsigned long nr, WARN_ON(!rwsem_is_locked(&sb->s_umount)); =20 bdi_split_work_to_wbs(sb->s_bdi, &work, skip_if_busy); - wb_wait_for_completion(&done); + wb_wait_for_completion(&done, bdi); } =20 /** @@ -3069,7 +3075,7 @@ void sync_inodes_sb(struct super_block *sb) /* protect against inode wb switch, see inode_switch_wbs_work_fn() */ bdi_down_write_wb_switch_rwsem(bdi); bdi_split_work_to_wbs(bdi, &work, false); - wb_wait_for_completion(&done); + wb_wait_for_completion(&done, bdi); bdi_up_write_wb_switch_rwsem(bdi); =20 wait_sb_inodes(sb); diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index c2284466e7aa66..808d939d2ca7f9 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -39,7 +39,8 @@ struct backing_dev_info *bdi_alloc(int node_id); void wb_start_background_writeback(struct bdi_writeback *wb); void wb_workfn(struct work_struct *work); =20 -void wb_wait_for_completion(struct wb_completion *done); +void wb_wait_for_completion(struct wb_completion *done, + struct backing_dev_info *bdi); =20 extern spinlock_t bdi_lock; extern struct list_head bdi_list; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ac6c43ea8c5a6d..df462d279a655e 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4525,7 +4525,7 @@ static void mem_cgroup_css_free(struct cgroup_subsys_= state *css) =20 #ifdef CONFIG_CGROUP_WRITEBACK for (i =3D 0; i < MEMCG_CGWB_FRN_CNT; i++) - wb_wait_for_completion(&memcg->cgwb_frn[i].done); + wb_wait_for_completion(&memcg->cgwb_frn[i].done, NULL); #endif if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nosocket) static_branch_dec(&memcg_sockets_enabled_key); --=20 2.53.0-Meta From nobody Tue Nov 24 04:33:14 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=82.195.75.108 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793968091; b=xVI6J4Gh5jMyuP7SIYRBrXJ9dD8cinqj2lVtdjri8ZWdzRvUf7EjOctB38XSeV4Km0LB 6WUm2qb8VmZ3MJ6y0YaqEcJMcJCvfmrwoYr0k6hbc+UnoIjoOAvxx9Km3gFNDcKG44clw apZ0brcT+z/udXQYTKIEzC4bxz5jZmJUBIvAlb31JVwCttFzDxdQV1qYpKs8o79jgNE5D EpNoiwCxpwV8qzyNHJmE0bSbKPodKV8k3JZD1wCKWLaju3JC8O/IL7muEUu++yVUyDXnf rcukCcsWBuRKE/l2BwoWgNh4jkQfI17HA8yY71fmzdS0ZHLxzxl8AL0sAKx/bol516g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793968091; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Debian-User; bh=gvU9Ll/eiIhTIGP9YekbSrp0PA62VwZ43mnN9JohyA8=; b=ibFpmumGaEXfkIVBtiwfZojJbR14BkKCc6MV61aMrS4gasCUroqjVGcohhAQx68FStFn c2T0roO0xC0U0CxfVVwObE0Cg572OwpYaz4x0RYrUWf0JHDDhC3K8fDkDn1u2Nk2cu7UX vcgAV5DijONgQwQQmjEeiyKZvmAXDcv+lDSBihz5k4bAY0B+obTQUx2kMJbb1ef8i3hOD CdE1MGMtH9CZEm/V/PYaYniSoNANsnp8I7JIdjPluBqOUmnhhNYEr++jrP1i0AUDRL6l5 vzBHilrEKsMiClJzu7IC0rgymY8jSx3ExkvyMa809wSGYyuSm0ag/XTYgDyP2fvoX5w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=debian.org; spf=pass smtp.mailfrom=debian.org; arc=none smtp.remote-ip=82.195.75.108 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B02B0606D81B; Fri, 6 Nov 2026 12:28:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B02B0606D81B Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=gvU9Ll/eiIhTIGP9YekbSrp0PA62VwZ43mnN9JohyA8=; b=kriSbH89ZxwtRAa6ULhkqiNJJf TMaNoX6df9t3k6PGp1kYsjOs/Uk4kZlxd2LT9Ef0SVLrsbktATcTSLmjMZbnnyVnbTWWpurDISd+d JmstELL20CDQKrzTqq0bPXA53sRl103ypUpcJhT/R+rAYa+KbS0BxwjatXRBnjdmx+H7p+GL2b5Gz /xdfUVsC5BR13YX2wUFQ2uS/O/m8bqGuL2PKCYS3i3enLAd6v/7olOpcw8Evo+zvIWpMgG78xNUN4 m3WmW0/zWol98h641oDlS5urIAKqVHsgB2c7urVMjSPBfchScJyINF7kaVchSMscNAexmiTMWOoUV gtQVcWgA==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1xPJ2t-009HUA-2L; Fri, 06 Nov 2026 12:27:51 +0000 From: Breno Leitao Date: Fri, 06 Nov 2026 04:26:33 -0800 Subject: [PATCH 3/4] writeback: log the end of a slow writeback wait X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261106-writeback_stall_report-v1-3-bf0c3b9023a5@debian.org> References: <20261106-writeback_stall_report-v1-0-bf0c3b9023a5@debian.org> In-Reply-To: <20261106-writeback_stall_report-v1-0-bf0c3b9023a5@debian.org> To: Alexander Viro , Christian Brauner , Jan Kara , Julian Sun , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.17-dev-ce4c1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2421; i=leitao@debian.org; h=from:subject:message-id; bh=iWceDHwwzC7CtVXVGCT6gvnNpBmDPTUwLcY2UEonv3g=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBq7cexBfiJ3VegtWonP+xsYLQRVNrpAkov7A9YO NvPZ0oPNouJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCau3HsQAKCRA1o5Of/Hh3 be1dD/4nmrxOfJYJw/5P28bGYcp4gHuYsEy9nJmS7KV0gQju7E62cEKfqwun2aIGlpvay7dRID8 cRLJGizJ4tudbbP4XCo5rOM30dE9DHgmSZTj1fnehuy7ZdYYdE1gWKZTpa/QNgZAZaWY/bgeTA0 OhbYSoGs+rzin3e9Fo6Ko8rjtcUXoXGbqBrOQ0+9N5vgbJG9tk/+BKtpEB1abqAzWwtqJWxfCWD RrkqpjokGI3TNCFMHmHwYt0JdOne/nnqF8WYlnwLyQAG2va1YbIbmqqEPWEmpvij2tP3VefCfMA cCo0ytSjAtkAL3seve6NPqHdupdLI6godDCn2iqJ+CjrJnpj35Sk/zQ2sd7nXNeTsRAEnBBharh aHNM07S935HTyiLMvulRUH0HsgIuJ/GW/gsK50J4mP6nx/EYgDeJdgQnahVc9eUpkJ0KgWZVoZ0 5SES4RL8biRgHO4lU9AonTVL+3nFktwndc6nSORxWZsN0edcM9eUOtGJGnZa/lhmgZ3bhj1rRrv 98yB0/h334klPS7bNk03tvG4v01dm6wVMJcm47vRXvIqlkw7uDj0CzMA99RqDEEsjjzEfHI/Ecu ZV70VFYUA1zo9p2jGVqzuaNuPQ55geQxE1r/U+aj5UIaGtHdcfnn1k+w48Jb8JkdwV2aosyQtE3 /ojLOEHIPKH8wpw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao A slow writeback wait ends with one more "has been waiting" report, printed by the wakeup that sees the last work item complete: INFO: The task sync:180 has been waiting for writeback completion for mor= e than 29 seconds. bdi 252:0, work items left: 0 That line reads as if the task were still waiting. To tell a slow writeback from a stuck one, the reader has to notice that the reports stopped, which is easy to miss in a busy log. Report only while work items are outstanding, and log how long the wait took once it is over: The task sync:181 waited 29 seconds for writeback completion on bdi 252:0 Signed-off-by: Breno Leitao Reviewed-by: Jan Kara --- fs/fs-writeback.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 3dee9d65eaf721..cdb2631b8552e1 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -201,17 +201,18 @@ static bool wb_wait_for_completion_cb(struct wb_compl= etion *done, { unsigned long timeout =3D sysctl_hung_task_timeout_secs; unsigned long waited_secs =3D (jiffies - done->wait_start) / HZ; + int left =3D atomic_read(&done->cnt); =20 done->progress_stamp =3D jiffies; - if (timeout && (waited_secs > timeout)) { + if (left && timeout && (waited_secs > timeout)) { pr_info("INFO: The task %s:%d has been waiting for writeback " "completion for more than %lu seconds.\n", current->comm, current->pid, waited_secs); pr_info(" bdi %s, work items left: %d\n", - bdi_dev_name(bdi), atomic_read(&done->cnt)); + bdi_dev_name(bdi), left); } =20 - return !atomic_read(&done->cnt); + return !left; } =20 /** @@ -228,9 +229,18 @@ static bool wb_wait_for_completion_cb(struct wb_comple= tion *done, void wb_wait_for_completion(struct wb_completion *done, struct backing_dev_info *bdi) { + unsigned long timeout, waited; + done->wait_start =3D jiffies; atomic_dec(&done->cnt); /* put down the initial count */ wait_event(*done->waitq, wb_wait_for_completion_cb(done, bdi)); + + timeout =3D sysctl_hung_task_timeout_secs; + waited =3D jiffies - done->wait_start; + if (timeout && waited > timeout * HZ) + pr_info("The task %s:%d waited %lu seconds for writeback completion on b= di %s\n", + current->comm, current->pid, waited / HZ, + bdi_dev_name(bdi)); } =20 #ifdef CONFIG_CGROUP_WRITEBACK --=20 2.53.0-Meta From nobody Tue Nov 24 04:33:14 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=82.195.75.108 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793968090; b=TYA6xDdPIupT1iJfVglqK83LoSXwBZJ/bWBVB8Ed2aQRNRqTpRtl0cJYXP7DKKhaMKte wTzG49GIfL0rWWujufFrwxutUgpq8A9kVyl00LgPJ4LVcCJefp1aOLG2PGUlHt/IDB4hC KfKCZzx/diSGFbx4pz962ygp867lHIiK0XyAMEeAFuzLjXKMd3wJZhGMKjd6/anraSVQ5 H2PU/9E8uHmn3/4JkmFh4/eacQoRb9hLMBsIFmYsKTZe8wgf6TwIDroRB/5xxTy8hZAUi tJ0hH7P9xUyB1lao7QjwyaEw8UoPe7oj+1gFdDk7VdLf2K1OVgj3G0SbNCDvcUETQyA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793968090; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Debian-User; bh=2xXFaQslh1ktPeBKSCuZk9/R23tHT1fC6uCumCOv/+0=; b=3QWpQuGyg5+WAGpHY4dw/pqvP9NIHJO9p3JSA44g4ctFd1l4nRi1aQYEevqsKZ7Wc0R0 li7XC7dnSs9oQzKwmZyjaf8w0b1tNtsbIB+sP2o9KF68r4ZKpK4+DmTmsBl/ny2LUuzMP U/yw7YnNeEM7mUNgayXronYaQqdTWjQ3GOrdFfQap1fxoZHj7T49x6evwFhMmwj8tldHb VFy6SHl2nwIiGxqG7pINZgluVNt3Cx8NQdrIqX6oJx07nxM/WxyqBLqHOV6Z50NGLGgC/ aIFmG1lvbcbw7kyAy/XoEQ9hvU7BD4zF5tFXPflV6FJdPJGRZz5AXAimDt780SEbnqg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b="iL/G31qz"; arc=none smtp.remote-ip=82.195.75.108 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD0E6606A32C; Fri, 6 Nov 2026 12:28:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BD0E6606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=iL/G31qz DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=2xXFaQslh1ktPeBKSCuZk9/R23tHT1fC6uCumCOv/+0=; b=iL/G31qzO/t6eU7RfzxkVzPE/q vld4ozQOKZqn3RUYRb4Vu11OwtF2bkOapFX6hJSBlpVAY6FalSigIhJk/PTZBCD25FvsHGhg/zofV m0S4QBx5QMjkjJB2mjGT9wj9exjhATNUSQDK7cVRBOI0BM//EtWJyz7ligxWkL+6JWN14QlogyGeA ttfgAPVsx9z8bXqy3+Aa2QT4gu4kaEhKw6fKapP5F5Gjd6NU4JUXyM9EOIwWSLVfZ2i2Qubfy7lkd aZPwb4Ety+iZmtkqmJkK08+jDrtM72PdYsCylBNnkSR+UQkc85iXnsdawtUcPOME3/AgzklJ4FThz mwczTPYA==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1xPJ2y-009HUO-3B; Fri, 06 Nov 2026 12:27:57 +0000 From: Breno Leitao Date: Fri, 06 Nov 2026 04:26:34 -0800 Subject: [PATCH 4/4] writeback: report a slow writeback wait once per timeout X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261106-writeback_stall_report-v1-4-bf0c3b9023a5@debian.org> References: <20261106-writeback_stall_report-v1-0-bf0c3b9023a5@debian.org> In-Reply-To: <20261106-writeback_stall_report-v1-0-bf0c3b9023a5@debian.org> To: Alexander Viro , Christian Brauner , Jan Kara , Julian Sun , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.17-dev-ce4c1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3599; i=leitao@debian.org; h=from:subject:message-id; bh=QXKI9SIu/Eds5pHpL1MLns0a6wtiNFTdigYu7otzjwM=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBq7cexGOIQ4gST4wB+rTUnGbrNRqBhpjCgYX9BW NvtvBMCWx+JAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCau3HsQAKCRA1o5Of/Hh3 bYUBD/4reK513xbT38cDoDqzrTNVacq1LEms0wFUfY8K8QaNUXeaE2hDmhuKy+fyE76RBQKsJSq 0gIUayfAQkoJHNAiS4oJihXsEd1JTxUkH8uWa+WRXumBlOK5un61ibF95g/lKKJwx5dtSGpQ+t9 4G2N5ZiSo4uetBoU7qxqyQdQFeDkFQfJuMlHRm3G2uTLqO5EsT/Ws9/SruNmSctI6iO6yqyN/OC hguy5SFNifotoy0+O9zvmrDKkA7Zr8Fg3iDxJZopc4S9L25U6nTPnr+uwRXatatpdb5rYOPzWsy 0NDTvY3lymKnLbnC4irDcJO5qBmN8EgdS9TFGsUZ6rShkYx52G+o4OAoF7gGXuLEMGVpBqQM35x Y0vGnx4kIIrNxoRebnUEjfSjGbsxst8rkQtP8e9xi0Rel+B0fU254/4Anx4bPozgGATgNoDSu0M srjJLe0spCvhcA7CHLzq6ksy2j0oactskh+SVdcvqX2UwYQlduqg1cuUfw6Bjx2ieSz0/PThv5b n4ncmGb4EoGKToCwbgDvXYDtbXkH0hG4ah5n+yJNhMPOXSgpEMDrn35Tt0uorjJlRlWBPAUIwpX wiDCDyROaBwd8F9gKKcK6hc+tKpi8efNgLUh/Bm58CCbDpdUMGmpYBFLChDpcJKViLfyPY5JRiP tWEzBTmcxdUer1Q== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao The slow writeback report is printed on every wakeup of the waiter past hung_task_timeout_secs, and the waiter is woken more often than that. Each flusher working for it wakes it once it has not run for half the timeout. All waiters on a bdi share bdi->wb_waitq, so a wakeup meant for one of them reaches all of them. A sync of files dirtied from two cgroups, on a throttled null_blk device with the timeout set to 5 seconds, gets a report every half timeout, each printed twice, 18 reports for a 29 second wait: [ 10.327992] INFO: The task sync:276 has been waiting for writeback com= pletion for more than 8 seconds. [ 10.328000] bdi 252:0, work items left: 2 [ 10.328003] INFO: The task sync:276 has been waiting for writeback com= pletion for more than 8 seconds. [ 10.328004] bdi 252:0, work items left: 2 [ 12.888187] INFO: The task sync:276 has been waiting for writeback com= pletion for more than 10 seconds. [ 12.888195] bdi 252:0, work items left: 2 [ 12.888197] INFO: The task sync:276 has been waiting for writeback com= pletion for more than 10 seconds. [ 12.888198] bdi 252:0, work items left: 2 ... Remember when the waiter last reported, and report again only once another timeout has passed. The wakeups do not change, so the hung task detector still sees the waiter making progress. The same test now prints 5 reports: [ 7.661129] INFO: The task sync:277 has been waiting for writeback com= pletion for more than 5 seconds. [ 7.661136] bdi 252:0, work items left: 2 [ 13.241102] INFO: The task sync:277 has been waiting for writeback com= pletion for more than 11 seconds. [ 13.241109] bdi 252:0, work items left: 2 ... [ 31.801068] The task sync:277 waited 29 seconds for writeback completi= on on bdi 252:0 Signed-off-by: Breno Leitao --- fs/fs-writeback.c | 5 ++++- include/linux/backing-dev-defs.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index cdb2631b8552e1..8d354784326f7a 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -204,7 +204,9 @@ static bool wb_wait_for_completion_cb(struct wb_complet= ion *done, int left =3D atomic_read(&done->cnt); =20 done->progress_stamp =3D jiffies; - if (left && timeout && (waited_secs > timeout)) { + if (left && timeout && + time_after(jiffies, done->report_stamp + timeout * HZ)) { + done->report_stamp =3D jiffies; pr_info("INFO: The task %s:%d has been waiting for writeback " "completion for more than %lu seconds.\n", current->comm, current->pid, waited_secs); @@ -232,6 +234,7 @@ void wb_wait_for_completion(struct wb_completion *done, unsigned long timeout, waited; =20 done->wait_start =3D jiffies; + done->report_stamp =3D done->wait_start; atomic_dec(&done->cnt); /* put down the initial count */ wait_event(*done->waitq, wb_wait_for_completion_cb(done, bdi)); =20 diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-d= efs.h index 4f10849373150d..f9fd3b1bf4c609 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -67,6 +67,7 @@ struct wb_completion { wait_queue_head_t *waitq; unsigned long progress_stamp; /* The jiffies when slow progress is detect= ed */ unsigned long wait_start; /* The jiffies when waiting for the writeback w= ork to finish */ + unsigned long report_stamp; /* The jiffies of the last report */ }; =20 #define __WB_COMPLETION_INIT(_waitq) \ --=20 2.53.0-Meta