[PATCH 0/3] blkcg: decouple cgroup v1 I/O accounting from throttling

From: Zhe Liu

Date: Tue Nov 10 2026 - 05:43:41 EST


Commit a3166c51702b ("blk-throttle: delay initialization until
configuration") deferred throttle policy activation until an I/O limit is
configured. However, cgroup v1 accounting still lives in the throttle
policy and is performed after the activation check in blk_should_throtl().
Without an activated throttle policy, v1 statistics such as
blkio.throttle.io_service_bytes remain zero even while I/O is issued.

This forces cgroup v1 users to configure the throttle policy just
to obtain I/O statistics, even when no throttling is needed.

This series moves cgroup v1 I/O statistics into blkcg and performs
accounting before checking throttle activation. It also moves
statistics reporting, reset and offline propagation into blkcg,
while preserving recursive aggregation and existing userspace
interfaces. With these changes, cgroup v1 I/O statistics work
without configuring throttle rules, while lazy throttle
initialization is preserved.

A/B-tested on linux-next (next-20261109) under QEMU (x86_64, TCG)
with the same kernel configuration. With no throttle rule, a 4 KiB
direct write accounted for 0 bytes and 0 BIOs on the baseline.
With the series applied, the same write accounted for 4096 bytes
and 1 BIO. A 1 MiB direct write split into 64 KiB BIOs accounted
for 1048576 bytes and 16 BIOs with the series applied.

Zhe Liu (3):
blkcg: allow printing rwstat samples without policy data
blkcg: move cgroup v1 I/O statistics out of the throttle policy
blkcg: account cgroup v1 I/O before checking throttle activation

block/blk-cgroup-rwstat.c | 18 ++--
block/blk-cgroup-rwstat.h | 2 +
block/blk-cgroup.c | 188 +++++++++++++++++++++++++++++++++++++-
block/blk-cgroup.h | 15 +++
block/blk-core.c | 1 +
block/blk-merge.c | 9 +-
block/blk-throttle.c | 78 ---------------
block/blk-throttle.h | 12 +--
8 files changed, 224 insertions(+), 99 deletions(-)

--
2.25.1