On Tue, Sep 03, 2024 at 09:51:49PM +0800, Yu Kuai wrote: > From: Yu Kuai <yukuai3@xxxxxxxxxx> > > Currently, blk-throttle handle all IO fifo, hence if data IO is > throttled and then meta IO is dispatched, the meta IO will have to wait > for the data IO, causing priority inversion problems. > > This patch support to handle metadata first and then pay debt while > throttling data. > > Test script: use cgroup v1 to throttle root cgroup, then create new > dir and file while write back is throttled > > test() { > mkdir /mnt/test/xxx > touch /mnt/test/xxx/1 > sync /mnt/test/xxx > sync /mnt/test/xxx > } > > mkfs.ext4 -F /dev/nvme0n1 -E lazy_itable_init=0,lazy_journal_init=0 > mount /dev/nvme0n1 /mnt/test > > echo "259:0 $((1024*1024))" > /sys/fs/cgroup/blkio/blkio.throttle.write_bps_device > dd if=/dev/zero of=/mnt/test/foo1 bs=16M count=1 conv=fdatasync status=none & > sleep 4 > > time test > echo "259:0 0" > /sys/fs/cgroup/blkio/blkio.throttle.write_bps_device > > sleep 1 > umount /dev/nvme0n1 > > Test result: time cost for creating new dir and file > before this patch: 14s > after this patch: 0.1s > > Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx> This is a lot simpler than I expected. Great. Acked-by: Tejun Heo <tj@xxxxxxxxxx> Thanks. -- tejun