mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 v7 2/2] nvmet: add cgroup_id to charge namespace I/O to a cgroup
Date: Thu, 01 Oct 2026 08:10:27 -1000	[thread overview]
Message-ID: <b214a375adad1579b2b17c0e9a0f4869@kernel.org> (raw)
In-Reply-To: <20260929232411.101087-3-yupeng0921@gmail.com>

Hello, Peng.

On Tue, Sep 29, 2026 at 04:24:11PM -0700, Peng Yu wrote:
> Implementation:
> * Add a `cgroup_id` attribute under the nvmet namespace folder, e.g.:
>   /sys/kernel/config/nvmet/subsystems/nqn.2026-09.io.test01:bdev/namespaces/1/cgroup_id
> * We can write a cgroup id to it, then that cgroup will control
>   the IOs used by the namespace.

This doesn't follow the usual description format or content. Can you
write it as prose explaining why the change is needed and what it does,
along the lines of the scenario section in the cover letter?

> +CONFIGFS_ATTR(nvmet_ns_, cgroup_id);

Documentation/ABI/stable/configfs-nvmet has an entry for each namespace
attribute. Can you add one for cgroup_id? It should say that it takes a
cgroup2 ID, that 0 clears it, that it can only be changed while the
namespace is disabled, and that the namespace's I/Os are charged to the
cgroup's effective io css.

> +static inline void nvmet_blkcg_set_bio(struct nvmet_ns *ns, struct bio *bio)
> +{
> +	struct cgroup_subsys_state *css;
> +
> +	if (!ns->cgrp)
> +		return;
> +
> +	css = cgroup_get_e_css(ns->cgrp, &io_cgrp_subsys);
> +	bio_associate_blkg_from_css(bio, css);
> +	css_put(css);
> +}

bio_init() and bio_alloc() already associate the bio with the current
kthread's blkcg, so each of these bios gets associated twice. If the rw
and zone append paths wrapped their bio allocations in
nvmet_blkcg_begin()/end() like the discard and flush paths do, this
function wouldn't be needed and chained bios would be covered
automatically. Not a blocker either way.

Otherwise, from the cgroup side, this looks fine to me.

Thanks.

--
tejun

      reply	other threads:[~2026-10-01 18:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 23:24 [PATCH v7 0/2] " Peng Yu
2026-09-29 23:24 ` [PATCH v7 1/2] cgroup: track the effective css in each cgroup Peng Yu
2026-10-01 17:56   ` Tejun Heo
2026-09-29 23:24 ` [PATCH v7 2/2] nvmet: add cgroup_id to charge namespace I/O to a cgroup Peng Yu
2026-10-01 18:10   ` Tejun Heo [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=b214a375adad1579b2b17c0e9a0f4869@kernel.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®