From: Chris Mason <clm@meta.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Chris Mason <clm@fb.com>,
linux-btrfs@vger.kernel.org, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
linux-mm@kvack.org
Subject: Re: What is the point of the wbc->for_kupdate check in btree_writepages
Date: Thu, 8 May 2025 12:11:13 -0400 [thread overview]
Message-ID: <80ba0638-e49b-498f-907b-24fb926a076e@meta.com> (raw)
In-Reply-To: <aBzCrkI7Jfisdnaw@infradead.org>
On 5/8/25 10:41 AM, Christoph Hellwig wrote:
> On Thu, May 08, 2025 at 10:33:24AM -0400, Chris Mason wrote:
>> btrfs can keep changing dirty tree blocks in memory, but once we write
>> them, we have to recow. Between transaction writeback kicking in every
>> 30 seconds and us calling balance_dirty_pages on the btree inode,
>> kupdate was doing more harm than good (back in 2007).
>
> I totally understand why you'd want to avoid background writeback. I
> just don't understand why it singles out for_kupdate.
>
>> Is the goal to get rid of for_kupdate?
>
> At least getting rid of exposing it to file systems, yes.
>
>> I wonder if we can just flag the
>> btree inode to exclude from kupdate, or keep it off whatever list
>> kupdate cares about etc.
>
> Not having the VM do writeback on metadata but running it from a fs
> LRU was a huge win in XFS. I'm not sure we have interfaces that keep
> data in the pagecache but never do any background writeback. But
> if you are fine with treating all background writeback equal that
> would be exactly where I'd like to go to.
>
I'm not sure how much dirty metadata can accumulate on XFS, but btrfs
isn't bound by any logs, so the only limit on dirty metadata is the size
of the filesystem and/or the size of ram.
If we skipped all background writeout, we'd end up letting metadata grow
until the full dirty limit was hit, which feels too bursty to me (please
correct me if I've got that part wrong).
Josef spent a bunch of time on metadata-in-slab and our own LRU, but
with the volume of dirty tree blocks, my memory is that he basically
would have needed to recreate a bunch of the dirty balance plumbing, and
decided it wasn't worth it.
I'd certainly be in favor of making balance_dirty_pages() and background
writeback able to integrate with private LRUs. If it's already possible
that's going to be a much better solution than our !for_kupdate hack.
-chris
prev parent reply other threads:[~2025-05-08 16:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 6:06 What is the point of the wbc->for_kupdate check in btree_writepages Christoph Hellwig
2025-05-08 14:33 ` Chris Mason
2025-05-08 14:41 ` Christoph Hellwig
2025-05-08 16:11 ` Chris Mason [this message]
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=80ba0638-e49b-498f-907b-24fb926a076e@meta.com \
--to=clm@meta.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=hch@infradead.org \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-mm@kvack.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