@@ -974,11 +974,12 @@ static int throtl_dispatch_tg(struct throtl_grp *tg)
static int throtl_select_dispatch(struct throtl_service_queue *parent_sq)
{
- unsigned int nr_disp = 0;
+ unsigned int sum_disp = 0;
while (1) {
struct throtl_grp *tg = throtl_rb_first(parent_sq);
struct throtl_service_queue *sq = &tg->service_queue;
+ unsigned int nr_disp;
if (!tg)
break;
@@ -988,16 +989,23 @@ static int throtl_select_dispatch(struct throtl_service_queue *parent_sq)
throtl_dequeue_tg(tg);
- nr_disp += throtl_dispatch_tg(tg);
+ throtl_log(sq, "dispatch queued=%u/%u",
+ sq->nr_queued[READ], sq->nr_queued[WRITE]);
+
+ nr_disp = throtl_dispatch_tg(tg);
+
+ throtl_log(sq, "dispatch disp=%u", nr_disp);
+
+ sum_disp += nr_disp;
if (sq->nr_queued[0] || sq->nr_queued[1])
tg_update_disptime(tg);
- if (nr_disp >= throtl_quantum)
+ if (sum_disp >= throtl_quantum)
break;
}
- return nr_disp;
+ return sum_disp;
}
/**
@@ -1031,13 +1039,8 @@ again:
dispatched = false;
while (true) {
- throtl_log(sq, "dispatch nr_queued=%u read=%u write=%u",
- sq->nr_queued[READ] + sq->nr_queued[WRITE],
- sq->nr_queued[READ], sq->nr_queued[WRITE]);
-
ret = throtl_select_dispatch(sq);
if (ret) {
- throtl_log(sq, "bios disp=%u", ret);
dispatched = true;
}
on throtl_pending_timer_fn(), the number of queued rw bios of sq and dispatched bios are logged, but the numbers are meaningless, because the dispatched bios are NOT queued on sq->queued[] instead theses bios are queued on the sq of tg queued on sq->pending_tree, so move these two throtl_log() to throtl_select_dispatch. before patch: 1. throttle on / throtl / [R] bio. bdisp=18432 sz=262144 bps=512000 ... queued=1/0 throtl dispatch nr_queued=0 read=0 write=0 ...... throtl bios disp=1 2. throttle on / and /1 throtl /1 [R] bio. bdisp=40960 sz=262144 bps=1024000 ... queued=1/0 throtl dispatch nr_queued=0 read=0 write=0 ...... throtl bios disp=1 after patch: 1. throttle on / throtl / [R] bio. bdisp=26624 sz=262144 bps=512000 ... queued=1/0 throtl / dispatch queued=2/0 ...... throtl / dispatch disp=1 2. throttle on / and /1 throtl /1 [R] bio. bdisp=81920 sz=262144 bps=1024000 ... queued=1/0 throtl /1 dispatch queued=2/0 ...... throtl /1 dispatch disp=1 Signed-off-by: Hou Tao <houtao1@huawei.com> --- block/blk-throttle.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)