summaryrefslogtreecommitdiffstats
path: root/block/blk-throttle.c
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2022-08-27 12:16:36 +0200
committerJens Axboe <axboe@kernel.dk>2022-09-12 08:20:07 +0200
commit8c25ed0cb9d2e349ebebfeacf7ce1ae015afe54d (patch)
tree35ef98f722116826a86192818072b417d77e3159 /block/blk-throttle.c
parentblk-throttle: use 'READ/WRITE' instead of '0/1' (diff)
downloadlinux-8c25ed0cb9d2e349ebebfeacf7ce1ae015afe54d.tar.xz
linux-8c25ed0cb9d2e349ebebfeacf7ce1ae015afe54d.zip
blk-throttle: calling throtl_dequeue/enqueue_tg in pairs
It's a little weird to call throtl_dequeue_tg() unconditionally in throtl_select_dispatch(), since it will be called in tg_update_disptime() again if some bio is still throttled. Thus call it later if there are no throttled bio. There are no functional changes. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Acked-by: Tejun Heo <tj@kernel.org> Link: https://lore.kernel.org/r/20220827101637.1775111-3-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-throttle.c')
-rw-r--r--block/blk-throttle.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 27d46a7d309b..4c12df8f6bae 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1146,13 +1146,13 @@ static int throtl_select_dispatch(struct throtl_service_queue *parent_sq)
if (time_before(jiffies, tg->disptime))
break;
- throtl_dequeue_tg(tg);
-
nr_disp += throtl_dispatch_tg(tg);
sq = &tg->service_queue;
if (sq->nr_queued[READ] || sq->nr_queued[WRITE])
tg_update_disptime(tg);
+ else
+ throtl_dequeue_tg(tg);
if (nr_disp >= THROTL_QUANTUM)
break;