From: Yu Kuai <[email protected]>
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/[email protected]
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