From: Tejun Heo <tj@kernel.org>
To: Peng Yu <yupeng0921@gmail.com>
Cc: "Christoph Hellwig" <hch@lst.de>,
"Sagi Grimberg" <sagi@grimberg.me>,
"Chaitanya Kulkarni" <kch@nvidia.com>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Koutný" <mkoutny@suse.com>,
"Josef Bacik" <josef@toxicpanda.com>,
"Jens Axboe" <axboe@kernel.dk>,
"Maurizio Lombardi" <mlombard@arkamax.eu>,
cgroups@vger.kernel.org, linux-block@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] nvmet: add cgroup_path to charge namespace I/O to a cgroup
Date: Wed, 23 Sep 2026 20:10:39 -1000 [thread overview]
Message-ID: <arS-38fE5r638g4Z@slm.duckdns.org> (raw)
In-Reply-To: <20260924053121.17703-1-yupeng0921@gmail.com>
Hello,
On Wed, Sep 23, 2026 at 10:31:21PM -0700, Peng Yu wrote:
...
> +#ifdef CONFIG_BLK_CGROUP
> +static int nvmet_blkcg_ns_enable(struct nvmet_ns *ns)
> +{
...
> + cgrp = cgroup_get_from_id(ns->cgroup_id);
> + if (IS_ERR(cgrp)) {
> + pr_err("failed to resolve cgroup id %llu: %ld\n",
> + ns->cgroup_id, PTR_ERR(cgrp));
> + return PTR_ERR(cgrp);
> + }
> +
> + css = cgroup_get_e_css(cgrp, &io_cgrp_subsys);
> + if (!css || css->cgroup != cgrp) {
> + pr_err("the io controller is not enabled in cgroup %llu\n",
> + ns->cgroup_id);
> + if (css)
> + css_put(css);
> + cgroup_put(cgrp);
> + return -EINVAL;
> + }
> + ns->blkcg_css = css;
This is really odd from interface POV. The user specified "associate IOs to
this cgroup" and that can fail if blkcg is not enabled on the cgroup. Even
if it succeeds, if blkcg gets disabled and re-enabled on the cgroup, the
device is still going to be issuing IOs as the old draining blkcg.
What the user can express is the target cgroup and the IOs should follow
whatever IO control that specified cgroup is under at the time of each IO
issue. Currently, cgroup_e_css() has to walk up the tree to find the
effective css for a given subsystem but updating cgroup code to add e_css[]
array on each cgroup to avoid the overhead shouldn't be too difficult.
Thanks.
--
tejun
next prev parent reply other threads:[~2026-09-24 6:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 5:31 Peng Yu
2026-09-24 6:10 ` Tejun Heo [this message]
2026-09-25 7:00 ` peng yu
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=arS-38fE5r638g4Z@slm.duckdns.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hch@lst.de \
--cc=josef@toxicpanda.com \
--cc=kch@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=mkoutny@suse.com \
--cc=mlombard@arkamax.eu \
--cc=sagi@grimberg.me \
--cc=yupeng0921@gmail.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®