diff mbox series

[v2,2/3] blk-throttle: calling throtl_dequeue/enqueue_tg in pairs

Message ID 20220827101637.1775111-3-yukuai1@huaweicloud.com (mailing list archive)
State New, archived
Headers show
Series blk-throttle cleanups | expand

Commit Message

Yu Kuai Aug. 27, 2022, 10:16 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com>

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>
---
 block/blk-throttle.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index fe1fa6441105..64002435fa43 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1101,13 +1101,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;