blk-iocost: calculate iocg->usages[] from iocg->local_stat.usage_us
authorTejun Heo <tj@kernel.org>
Tue, 1 Sep 2020 18:52:44 +0000 (14:52 -0400)
committerJens Axboe <axboe@kernel.dk>
Wed, 2 Sep 2020 01:38:32 +0000 (19:38 -0600)
commit1aa50d020c7148f5f0bde15ca80fe6f91a8c5a4e
tree47b92042284fe130d6a31b3e92b0091542fa508d
parent97eb19751f155903489f8d42ea658ace2c59faf7
blk-iocost: calculate iocg->usages[] from iocg->local_stat.usage_us

Currently, iocg->usages[] which are used to guide inuse adjustments are
calculated from vtime deltas. This, however, assumes that the hierarchical
inuse weight at the time of calculation held for the entire period, which
often isn't true and can lead to significant errors.

Now that we have absolute usage information collected, we can derive
iocg->usages[] from iocg->local_stat.usage_us so that inuse adjustment
decisions are made based on actual absolute usage. The calculated usage is
clamped between 1 and WEIGHT_ONE and WEIGHT_ONE is also used to signal
saturation regardless of the current hierarchical inuse weight.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-iocost.c
include/trace/events/iocost.h