summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linux.alibaba.com>2020-10-08 06:52:23 +0300
committerJens Axboe <axboe@kernel.dk>2020-10-08 17:01:37 +0300
commit7901601aef35082d8431d05ab50a3567f7624b55 (patch)
treeabac41987e02d3e86593714e33a22e2e8b640a6e /block
parent4247d9c8ba810c1d4a9502893a9ce1cec6abbf7a (diff)
downloadlinux-7901601aef35082d8431d05ab50a3567f7624b55.tar.xz
blk-throttle: Avoid getting the current time if tg->last_finish_time is 0
We only update the tg->last_finish_time when the low limitaion is enabled, so we can move the tg->last_finish_time validation a little forward to avoid getting the unnecessary current time stamp if the the low limitation is not enabled. Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-throttle.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 4007b26d4fd7..7e72102aa918 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -2077,10 +2077,14 @@ static void throtl_downgrade_check(struct throtl_grp *tg)
static void blk_throtl_update_idletime(struct throtl_grp *tg)
{
- unsigned long now = ktime_get_ns() >> 10;
+ unsigned long now;
unsigned long last_finish_time = tg->last_finish_time;
- if (now <= last_finish_time || last_finish_time == 0 ||
+ if (last_finish_time == 0)
+ return;
+
+ now = ktime_get_ns() >> 10;
+ if (now <= last_finish_time ||
last_finish_time == tg->checked_last_finish_time)
return;