Skip to content

Commit

Permalink
blk-throttle: Avoid tracking latency if low limit is invalid
Browse files Browse the repository at this point in the history
The IO latency tracking is only for LOW limit, so we should add a
validation to avoid redundant latency tracking if the LOW limit
is not valid.

Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Baolin Wang authored and axboe committed Oct 8, 2020
1 parent 7901601 commit b185efa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ static void throtl_update_latency_buckets(struct throtl_data *td)
unsigned long last_latency[2] = { 0 };
unsigned long latency[2];

if (!blk_queue_nonrot(td->queue))
if (!blk_queue_nonrot(td->queue) || !td->limit_valid[LIMIT_LOW])
return;
if (time_before(jiffies, td->last_calculate_time + HZ))
return;
Expand Down Expand Up @@ -2338,6 +2338,8 @@ void blk_throtl_bio_endio(struct bio *bio)
if (!blkg)
return;
tg = blkg_to_tg(blkg);
if (!tg->td->limit_valid[LIMIT_LOW])
return;

finish_time_ns = ktime_get_ns();
tg->last_finish_time = finish_time_ns >> 10;
Expand Down

0 comments on commit b185efa

Please sign in to comment.