linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.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,
	tj@kernel.org, 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: Tue, 27 Aug 2024 22:19:36 -0700	[thread overview]
Message-ID: <Zs6zaP52HRMQiWb1@infradead.org> (raw)
In-Reply-To: <20240828033224.146584-1-haifeng.xu@shopee.com>

On Wed, Aug 28, 2024 at 11:32:24AM +0800, Haifeng Xu wrote:
> +	} 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'll leave it to people more familiar with cgroups to decide if this
is the right thing to do, but if it is the code here should go into
a helper so that other metadata bio submitters can reuse it.  That
helper also should have a good comment explaining it.


  reply	other threads:[~2024-08-28  5:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-28  3:32 [PATCH] buffer: Associate the meta bio with blkg from buffer page Haifeng Xu
2024-08-28  5:19 ` Christoph Hellwig [this message]
2024-08-29 16:20 ` kernel test robot
2024-08-29 17:43 ` kernel test robot
2024-08-30 19:37 ` Tejun Heo
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=Zs6zaP52HRMQiWb1@infradead.org \
    --to=hch@infradead.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=tj@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;
as well as URLs for NNTP newsgroup(s).