Commit 8c25ed0c authored by Yu Kuai's avatar Yu Kuai Committed by Jens Axboe

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: default avatarYu Kuai <yukuai3@huawei.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20220827101637.1775111-3-yukuai1@huaweicloud.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 7e9c5c54
...@@ -1146,13 +1146,13 @@ static int throtl_select_dispatch(struct throtl_service_queue *parent_sq) ...@@ -1146,13 +1146,13 @@ static int throtl_select_dispatch(struct throtl_service_queue *parent_sq)
if (time_before(jiffies, tg->disptime)) if (time_before(jiffies, tg->disptime))
break; break;
throtl_dequeue_tg(tg);
nr_disp += throtl_dispatch_tg(tg); nr_disp += throtl_dispatch_tg(tg);
sq = &tg->service_queue; sq = &tg->service_queue;
if (sq->nr_queued[READ] || sq->nr_queued[WRITE]) if (sq->nr_queued[READ] || sq->nr_queued[WRITE])
tg_update_disptime(tg); tg_update_disptime(tg);
else
throtl_dequeue_tg(tg);
if (nr_disp >= THROTL_QUANTUM) if (nr_disp >= THROTL_QUANTUM)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment