From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Joanne Koong <joannelkoong@gmail.com>, miklos@szeredi.hu
Cc: linux-fsdevel@vger.kernel.org, david@redhat.com,
willy@infradead.org, linux-mm@kvack.org
Subject: Re: [PATCH v2 2/2] mm: remove BDI_CAP_WRITEBACK_ACCT
Date: Fri, 22 Aug 2025 23:42:36 +0200 [thread overview]
Message-ID: <2acaa457-2c9f-4285-8403-2896a152f929@samsung.com> (raw)
In-Reply-To: <a91010a8-e715-4f3d-9e22-e4c34efc0408@samsung.com>
On 22.08.2025 13:01, Marek Szyprowski wrote:
> On 08.07.2025 01:46, Joanne Koong wrote:
>> There are no users of BDI_CAP_WRITEBACK_ACCT now that fuse doesn't do
>> its own writeback accounting. This commit removes
>> BDI_CAP_WRITEBACK_ACCT.
>>
>> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
>> Acked-by: David Hildenbrand <david@redhat.com>
>
> This patch landed recently in linux-next as commit 167f21a81a9c ("mm:
> remove BDI_CAP_WRITEBACK_ACCT"). In my tests I found that it triggers
> the ./include/linux/backing-dev.h:239 warning. Reverting $subject on
> top of current linux-next fixes/hides this issue. Here is a detailed log:
>
> ------------[ cut here ]------------
> WARNING: ./include/linux/backing-dev.h:239 at
> __folio_start_writeback+0x25a/0x26a, CPU#1: swapper/0/1
> Modules linked in:
> CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted
> 6.17.0-rc2-next-20250822 #10852 NONE
> Hardware name: StarFive VisionFive 2 v1.2A (DT)
> epc : __folio_start_writeback+0x25a/0x26a
> ra : __folio_start_writeback+0x258/0x26a
>
> [<ffffffff80202222>] __folio_start_writeback+0x25a/0x26a
> [<ffffffff802f3260>] __block_write_full_folio+0x124/0x39c
> [<ffffffff802f4b6e>] block_write_full_folio+0x8a/0xbc
> [<ffffffff804dbf42>] blkdev_writepages+0x3e/0x8a
> [<ffffffff802030fa>] do_writepages+0x78/0x11a
> [<ffffffff801f2e0e>] filemap_fdatawrite_wbc+0x4a/0x62
> [<ffffffff801f6d66>] __filemap_fdatawrite_range+0x52/0x78
> [<ffffffff801f6fdc>] filemap_write_and_wait_range+0x40/0x68
> [<ffffffff804dacae>] set_blocksize+0xd8/0x152
> [<ffffffff804dae18>] sb_min_blocksize+0x44/0xce
> [<ffffffff803a0c7a>] ext4_fill_super+0x182/0x2914
> [<ffffffff802a72e6>] get_tree_bdev_flags+0xf0/0x168
> [<ffffffff802a736c>] get_tree_bdev+0xe/0x16
> [<ffffffff8039a09e>] ext4_get_tree+0x14/0x1c
> [<ffffffff802a5062>] vfs_get_tree+0x1a/0xa4
> [<ffffffff802d17d4>] path_mount+0x23a/0x8ae
> [<ffffffff80c20cd4>] init_mount+0x4e/0x86
> [<ffffffff80c01622>] do_mount_root+0xe0/0x166
> [<ffffffff80c01814>] mount_root_generic+0x11e/0x2d6
> [<ffffffff80c02746>] initrd_load+0xf8/0x2b6
> [<ffffffff80c01d38>] prepare_namespace+0x150/0x258
> [<ffffffff80c01310>] kernel_init_freeable+0x2f2/0x316
> [<ffffffff80b6d896>] kernel_init+0x1e/0x13a
> [<ffffffff80012288>] ret_from_fork_kernel+0x14/0x208
> [<ffffffff80b79392>] ret_from_fork_kernel_asm+0x16/0x18
> irq event stamp: 159263
> hardirqs last enabled at (159263): [<ffffffff805e7e4a>]
> percpu_counter_add_batch+0xa6/0xda
> hardirqs last disabled at (159262): [<ffffffff805e7e40>]
> percpu_counter_add_batch+0x9c/0xda
> softirqs last enabled at (159248): [<ffffffff8002e972>]
> handle_softirqs+0x3ca/0x462
> softirqs last disabled at (159241): [<ffffffff8002eb72>]
> __irq_exit_rcu+0xe2/0x10c
> ---[ end trace 0000000000000000 ]---
I've played a bit with the code modified by the $subject patch and it
looks that the following change fixes the issue, although I didn't
analyze exactly where struct bdi_writeback is being modified:
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 99e80bdb3084..3887ac2e6475 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2984,7 +2984,7 @@ bool __folio_end_writeback(struct folio *folio)
if (mapping && mapping_use_writeback_tags(mapping)) {
struct inode *inode = mapping->host;
- struct bdi_writeback *wb = inode_to_wb(inode);
+ struct bdi_writeback *wb;
unsigned long flags;
xa_lock_irqsave(&mapping->i_pages, flags);
@@ -2992,6 +2992,7 @@ bool __folio_end_writeback(struct folio *folio)
__xa_clear_mark(&mapping->i_pages, folio_index(folio),
PAGECACHE_TAG_WRITEBACK);
+ wb = inode_to_wb(inode);
wb_stat_mod(wb, WB_WRITEBACK, -nr);
__wb_writeout_add(wb, nr);
if (!mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK)) {
@@ -3024,7 +3025,7 @@ void __folio_start_writeback(struct folio *folio,
bool keep_write)
if (mapping && mapping_use_writeback_tags(mapping)) {
XA_STATE(xas, &mapping->i_pages, folio_index(folio));
struct inode *inode = mapping->host;
- struct bdi_writeback *wb = inode_to_wb(inode);
+ struct bdi_writeback *wb;
unsigned long flags;
bool on_wblist;
@@ -3035,6 +3036,7 @@ void __folio_start_writeback(struct folio *folio,
bool keep_write)
on_wblist = mapping_tagged(mapping,
PAGECACHE_TAG_WRITEBACK);
xas_set_mark(&xas, PAGECACHE_TAG_WRITEBACK);
+ wb = inode_to_wb(inode);
wb_stat_mod(wb, WB_WRITEBACK, nr);
if (!on_wblist) {
wb_inode_writeback_start(wb);
> ...
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
next prev parent reply other threads:[~2025-08-22 21:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 23:46 [PATCH v2 0/2] fuse/mm: " Joanne Koong
2025-07-07 23:46 ` [PATCH v2 1/2] fuse: use default writeback accounting Joanne Koong
2025-07-09 11:06 ` Bernd Schubert
2025-07-11 11:58 ` David Hildenbrand
2025-07-07 23:46 ` [PATCH v2 2/2] mm: remove BDI_CAP_WRITEBACK_ACCT Joanne Koong
[not found] ` <CGME20250822110133eucas1p2378459d1e802c718ef6028efc06625dc@eucas1p2.samsung.com>
2025-08-22 11:01 ` Marek Szyprowski
[not found] ` <CGME20250822214238eucas1p16934a3c0a9575e6044b61e11f3635af0@eucas1p1.samsung.com>
2025-08-22 21:42 ` Marek Szyprowski [this message]
2025-08-22 23:20 ` Joanne Koong
2025-08-01 20:44 ` [PATCH v2 0/2] fuse/mm: " Joanne Koong
2025-08-18 12:28 ` Miklos Szeredi
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=2acaa457-2c9f-4285-8403-2896a152f929@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=david@redhat.com \
--cc=joannelkoong@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=miklos@szeredi.hu \
--cc=willy@infradead.org \
/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