From: Tejun Heo <tj@kernel.org>
To: Haifeng Xu <haifeng.xu@shopee.com>
Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
tytso@mit.edu, yi.zhang@huaweicloud.com, yukuai1@huaweicloud.com,
linux-ext4@vger.kernel.org, linux-block@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] buffer: Associate the meta bio with blkg from buffer page
Date: Fri, 30 Aug 2024 09:37:37 -1000 [thread overview]
Message-ID: <ZtIfgc1CcG9XOu0-@slm.duckdns.org> (raw)
In-Reply-To: <20240828033224.146584-1-haifeng.xu@shopee.com>
Hello, Haifeng.
On Wed, Aug 28, 2024 at 11:32:24AM +0800, Haifeng Xu wrote:
...
> The filesystem is ext4(ordered). The meta data can be written out by
> writeback, but if there are too many dirty pages, we had to do
> checkpoint to write out the meta data in current thread context.
>
> In this case, the blkg of thread1 has set io.max, so the j_checkpoint_mutex
> can't be released and many threads must wait for it. However, the blkg from
> buffer page didn' set any io policy. Therefore, for the meta buffer head,
> we can associate the bio with blkg from the buffer page instead of current
> thread context.
>
> Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
> ---
> fs/buffer.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/fs/buffer.c b/fs/buffer.c
> index e55ad471c530..a7889f258d0d 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -2819,6 +2819,17 @@ static void submit_bh_wbc(blk_opf_t opf, struct buffer_head *bh,
> if (wbc) {
> wbc_init_bio(wbc, bio);
> wbc_account_cgroup_owner(wbc, bh->b_page, bh->b_size);
> + } else if (buffer_meta(bh)) {
> + struct folio *folio;
> + struct cgroup_subsys_state *memcg_css, *blkcg_css;
> +
> + folio = page_folio(bh->b_page);
> + memcg_css = mem_cgroup_css_from_folio(folio);
> + if (cgroup_subsys_on_dfl(memory_cgrp_subsys) &&
> + cgroup_subsys_on_dfl(io_cgrp_subsys)) {
> + blkcg_css = cgroup_e_css(memcg_css->cgroup, &io_cgrp_subsys);
> + bio_associate_blkg_from_css(bio, blkcg_css);
I think the right way to do it is marking the bio with REQ_META and
implement forced charging in blk-throtl similar to blk-iocost.
Thanks.
--
tejun
next prev parent reply other threads:[~2024-08-30 19:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 3:32 Haifeng Xu
2024-08-28 5:19 ` Christoph Hellwig
2024-08-29 16:20 ` kernel test robot
2024-08-29 17:43 ` kernel test robot
2024-08-30 19:37 ` Tejun Heo [this message]
2024-08-31 6:11 ` Yu Kuai
2024-08-31 8:03 ` Tejun Heo
2024-08-31 9:48 ` Yu Kuai
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=ZtIfgc1CcG9XOu0-@slm.duckdns.org \
--to=tj@kernel.org \
--cc=brauner@kernel.org \
--cc=haifeng.xu@shopee.com \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
--cc=yi.zhang@huaweicloud.com \
--cc=yukuai1@huaweicloud.com \
/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
all inboxes | Powered by JetHome®