From: David Sterba <firstname.lastname@example.org> To: Dennis Zhou <email@example.com> Cc: David Sterba <firstname.lastname@example.org>, Chris Mason <email@example.com>, Josef Bacik <firstname.lastname@example.org>, email@example.com, firstname.lastname@example.org Subject: Re: [PATCH v2 2/2] btrfs: fix compressed write bio attribution Date: Tue, 17 Dec 2019 16:05:48 +0100 Message-ID: <20191217150548.GF3929@suse.cz> (raw) In-Reply-To: <20191213222149.GA46346@dennisz-mbp.dhcp.thefacebook.com> On Fri, Dec 13, 2019 at 02:21:49PM -0800, Dennis Zhou wrote: > On Fri, Dec 13, 2019 at 01:24:01PM +0100, David Sterba wrote: > > On Thu, Dec 12, 2019 at 10:19:34AM -0800, Dennis Zhou wrote: > > > From a0569aebde08e31e994c92d0b70befb84f7f5563 Mon Sep 17 00:00:00 2001 > > > From: Dennis Zhou <email@example.com> > > > Date: Wed, 11 Dec 2019 15:20:15 -0800 > > > > > > Bio attribution is handled at bio_set_dev() as once we have a device, we > > > have a corresponding request_queue and then can derive the current css. > > > In special cases, we want to attribute to bio to someone else. This can > > > be done by calling bio_associate_blkg_from_css() or > > > kthread_associate_blkcg() depending on the scenario. Btrfs does this for > > > compressed writeback as they are handled by kworkers, so the latter can > > > be done here. > > > > > > Commit 1a41802701ec ("btrfs: drop bio_set_dev where not needed") removes > > > early bio_set_dev() calls prior to submit_stripe_bio(). This breaks the > > > above assumption that we'll have a request_queue when we are doing > > > association. To fix this, switch to using kthread_associate_blkcg(). > > > > Can be kthread_associate_blkcg used also for submit_extent_page that > > calls bio_associate_blkg_from_css indirectly when initializing wbc? > > > > 2996 bio_set_dev(bio, bdev); > > 2997 wbc_init_bio(wbc, bio); > > 2998 wbc_account_cgroup_owner(wbc, page, page_size); > > > > wbc_init_bio: > > > > if (wbc) > > bio_associate_blkg_from_css(); > > Correct me if I'm wrong, but I don't think submit_extent_page() is only > called from kthread contexts. So, we wouldn't be able to rely on > kthread_associate_blkcg(). Yeah, the kthread is not guaranteed here. > I can think about how to make wbc better for association in general, but > it's a percpu decrement and increment so it shouldn't really be much in > overhead. Performance is not my concern here, the addition of bios and blkcg association is new and there were some integration bugs where I independently removed early bdev association while the blkg relied on that. I'm looking for ways to make it less error prone and the kthread association looks exactly like that so I was curious if it's possible to use it everywhere. If not, the bdev needs to be found from other available data.
next prev parent reply index Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-12 0:07 [PATCH 1/2] btrfs: punt all bios created in btrfs_submit_compressed_write() Dennis Zhou 2019-12-12 0:07 ` [PATCH 2/2] btrfs: fix compressed write bio attribution Dennis Zhou 2019-12-12 15:18 ` David Sterba 2019-12-12 16:19 ` Dennis Zhou 2019-12-12 18:19 ` [PATCH v2 " Dennis Zhou 2019-12-13 12:24 ` David Sterba 2019-12-13 22:21 ` Dennis Zhou 2019-12-17 15:05 ` David Sterba [this message] 2019-12-17 18:44 ` Dennis Zhou 2019-12-12 0:15 ` [PATCH 1/2] btrfs: punt all bios created in btrfs_submit_compressed_write() Chris Mason 2019-12-30 15:08 ` David Sterba
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=20191217150548.GF3929@suse.cz \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.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
Linux-BTRFS Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \ email@example.com public-inbox-index linux-btrfs Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs AGPL code for this site: git clone https://public-inbox.org/public-inbox.git