From: Yu Kuai <yukuai@kernel.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: "Tejun Heo" <tj@kernel.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Koutný" <mkoutny@suse.com>,
"Jonathan Corbet" <corbet@lwn.net>, "Yu Kuai" <yukuai@fygo.io>,
"Josef Bacik" <josef@toxicpanda.com>, "Coly Li" <colyli@fygo.io>,
"Kent Overstreet" <kent.overstreet@linux.dev>,
"Alasdair Kergon" <agk@redhat.com>,
"Mike Snitzer" <snitzer@kernel.org>,
"Mikulas Patocka" <mpatocka@redhat.com>,
"Benjamin Marzinski" <bmarzins@redhat.com>,
"Song Liu" <song@kernel.org>, "Dan Williams" <djbw@kernel.org>,
"Vishal Verma" <vishal.l.verma@intel.com>,
"Dave Jiang" <dave.jiang@intel.com>,
"Alison Schofield" <alison.schofield@intel.com>,
"Pankaj Gupta" <pankaj.gupta.linux@gmail.com>,
"Andreas Gruenbacher" <agruenba@redhat.com>,
"Matthew Wilcox" <willy@infradead.org>, "Jan Kara" <jack@suse.cz>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Chris Li" <chrisl@kernel.org>,
"Kairui Song" <kasong@tencent.com>,
"Christoph Hellwig" <hch@lst.de>,
"Nilay Shroff" <nilay@linux.ibm.com>,
"Tao Cui" <cui.tao@linux.dev>,
cgroups@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev,
linux-raid@vger.kernel.org, nvdimm@lists.linux.dev,
virtualization@lists.linux.dev, gfs2@lists.linux.dev,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: [RFC PATCH v1 0/3] blk-cgroup: store blkcg in bio before blkcg_mutex conversion
Date: Tue, 4 Aug 2026 14:53:10 +0800 [thread overview]
Message-ID: <20260804065313.2092022-1-yukuai@kernel.org> (raw)
From: Yu Kuai <yukuai@fygo.io>
This RFC is a preparatory series for the blkcg_mutex conversion proposed in
the blkcg_mutex RFC v2 series [1]. That series moves queue-local blkg
topology synchronization from q->queue_lock to q->blkcg_mutex. A direct
conversion is awkward while bios store queue-local blkg references, because
bio allocation, bio_set_dev(), remap and clone paths can run in contexts
where creating a missing blkg must not sleep or is unnecessary.
This set makes the bio association queue-independent by storing the blkcg
in the bio instead of a blkg. A blkg is looked up from the bio's blkcg and
current bdev only when blkcg policy or accounting code needs it. The first
successful policy lookup pins the blkg with a bio-owned reference tracked by
BIO_BLKG_REF; the reference is dropped when the bio cgroup association is
cleared or when bio_set_dev() changes the lookup key.
Patch 1 adds accessors for the current bio cgroup state and factors out the
release path. Patch 2 switches the stored bio association from blkg to blkcg,
adds lookup/create helpers for policy users, and converts the blkcg policies
and cloned-bio users. Patch 3 moves async bio punt state from blkg to blkcg
so punted bios do not instantiate a queue-local blkg when no policy needs one.
This is v1 of this preparatory set; there is no previous version.
Related series:
[1] RFC v2 blk-cgroup: protect blkgs with blkcg_mutex
https://lore.kernel.org/r/20260724123037.3004560-1-yukuai@kernel.org
Yu Kuai (3):
blk-cgroup: add helpers for bio cgroup state
blk-cgroup: store blkcg in bio instead of blkg
blk-cgroup: move async bio punt state to blkcg
Documentation/admin-guide/cgroup-v2.rst | 2 +-
block/bfq-cgroup.c | 14 +-
block/bfq-iosched.c | 18 +-
block/bio.c | 22 +--
block/blk-cgroup-fc-appid.c | 10 +-
block/blk-cgroup.c | 251 +++++++++++++++---------
block/blk-cgroup.h | 40 +++-
block/blk-crypto-fallback.c | 2 +-
block/blk-iocost.c | 12 +-
block/blk-iolatency.c | 11 +-
block/blk-ioprio.c | 2 +-
block/blk-throttle.c | 2 +-
block/blk-throttle.h | 2 +-
drivers/md/bcache/request.c | 2 +-
drivers/md/dm.c | 2 +-
drivers/md/md.c | 2 +-
drivers/nvdimm/nd_virtio.c | 2 +-
fs/gfs2/lops.c | 3 +-
include/linux/bio.h | 20 +-
include/linux/blk_types.h | 9 +-
include/linux/writeback.h | 2 +-
mm/page_io.c | 10 +-
22 files changed, 268 insertions(+), 172 deletions(-)
base-commit: f2690679ecf3a3151688ebef766dd2512ff95854
--
2.51.0
next reply other threads:[~2026-08-04 6:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 6:53 Yu Kuai [this message]
2026-08-04 6:53 ` [RFC PATCH v1 1/3] blk-cgroup: add helpers for bio cgroup state Yu Kuai
2026-08-04 10:52 ` Jan Kara
2026-08-04 13:25 ` Christoph Hellwig
2026-08-04 15:07 ` yu kuai
2026-08-04 6:53 ` [RFC PATCH v1 2/3] blk-cgroup: store blkcg in bio instead of blkg Yu Kuai
2026-08-04 9:19 ` Tao Cui
2026-08-04 13:32 ` Christoph Hellwig
2026-08-04 15:30 ` yu kuai
2026-08-04 15:47 ` Christoph Hellwig
2026-08-05 0:58 ` Tao Cui
2026-08-06 9:22 ` Michal Koutný
2026-08-04 6:53 ` [RFC PATCH v1 3/3] blk-cgroup: move async bio punt state to blkcg 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=20260804065313.2092022-1-yukuai@kernel.org \
--to=yukuai@kernel.org \
--cc=agk@redhat.com \
--cc=agruenba@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alison.schofield@intel.com \
--cc=axboe@kernel.dk \
--cc=bmarzins@redhat.com \
--cc=cgroups@vger.kernel.org \
--cc=chrisl@kernel.org \
--cc=colyli@fygo.io \
--cc=corbet@lwn.net \
--cc=cui.tao@linux.dev \
--cc=dave.jiang@intel.com \
--cc=djbw@kernel.org \
--cc=dm-devel@lists.linux.dev \
--cc=gfs2@lists.linux.dev \
--cc=hannes@cmpxchg.org \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=josef@toxicpanda.com \
--cc=kasong@tencent.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-raid@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=mpatocka@redhat.com \
--cc=nilay@linux.ibm.com \
--cc=nvdimm@lists.linux.dev \
--cc=pankaj.gupta.linux@gmail.com \
--cc=snitzer@kernel.org \
--cc=song@kernel.org \
--cc=tj@kernel.org \
--cc=virtualization@lists.linux.dev \
--cc=vishal.l.verma@intel.com \
--cc=willy@infradead.org \
--cc=yukuai@fygo.io \
/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