From: Song Wang <wangsin...@gmail.com> Hi Mike,
Sorry for interruption. For cgroup v2 blkio writeback throttle, bio uses its blkcg->css and bi_bdev to calc out blkg. after the commit ca522482e3ea ("dm: pass NULL bdev to bio_alloc_clone"), when DM targets call bio_set_dev()->bio_associate_blkg(), the bio->bi_blkg is NULL, so css is another new blkcg_css(), and associated blkg is root_blkg. this makes cgv2 blkio writeback throttle not work on the underlying device. It's very easy to reproduce this issue, firstly create and mount the lvm: sda 8:0 0 20G 0 disk └─vg-lv 252:0 0 16G 0 lvm /mnt vg-lv: 0 33554432 linear 8:0 2048 Secondly, setup the cgv2 blkio writeback throttle: mkdir /sys/fs/cgroup/cg cd /sys/fs/cgroup/cg echo 8:0 wbps=$((10*1024*1024)) >> io.max echo $$ > cgroup.procs Lastly, use dd and iostat to test and monitor: dd if=/dev/urandom of=/mnt/test bs=1M iostat -xmd 3 sda Now you can see that the throttle is not working, and the throttle can work before this commit (you need to backport the commit 320fb0f9, which fixes a former throttle-not-working bug). However, cgv2 blkio writeback throttle can still work well if you limit vg-lv and test vg-lv, or if you limit sda and test sda without lvm. So, I was wondering if this is a bug or a feature-correction? Thanks Song