blk-throttle: Split the blkthrotl queue
authorZizhi Wo <wozizhi@huawei.com>
Tue, 6 May 2025 02:09:32 +0000 (10:09 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 13 May 2025 18:08:27 +0000 (12:08 -0600)
commitf2c4902bd08b854a23c3c2ab352382fd7eef959f
treeb34ec85cdefd4772d7f96599ec8586afdd9ce751
parentc4da7bf54b1f76e7c5c8cc6d1c4db8b19af67c5d
blk-throttle: Split the blkthrotl queue

This patch splits the single queue into separate bps and iops queues. Now,
an IO request must first pass through the bps queue, then the iops queue,
and finally be dispatched. Due to the queue splitting, we need to modify
the throtl add/peek/pop function.

Additionally, the patch modifies the logic related to tg_dispatch_time().
If bio needs to wait for bps, function directly returns the bps wait time;
otherwise, it charges bps and returns the iops wait time so that bio can be
directly placed into the iops queue afterward. Note that this may lead to
more frequent updates to disptime, but the overhead is negligible for the
slow path.

Signed-off-by: Zizhi Wo <wozizhi@huawei.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Zizhi Wo <wozizhi@huaweicloud.com>
Link: https://lore.kernel.org/r/20250506020935.655574-6-wozizhi@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-throttle.c
block/blk-throttle.h