iocost: reimplement debt forgiveness using average usage
authorTejun Heo <tj@kernel.org>
Fri, 18 Sep 2020 00:44:55 +0000 (20:44 -0400)
committerJens Axboe <axboe@kernel.dk>
Fri, 25 Sep 2020 14:35:02 +0000 (08:35 -0600)
commitc7af2a003a411853fc9c805efe96d10dcc8adb5f
tree9ea9e5985b7224484015bfc3474c7cbdeb6f2e5f
parentd95178410b7706844491efb77fb0a37a69f7a5e6
iocost: reimplement debt forgiveness using average usage

Debt forgiveness logic was counting the number of consecutive !busy periods
as the trigger condition. While this usually works, it can easily be thrown
off by temporary fluctuations especially on configurations w/ short periods.

This patch reimplements debt forgiveness so that:

* Use the average usage over the forgiveness period instead of counting
  consecutive periods.

* Debt is reduced at around the target rate (1/2 every 100ms) regardless of
  ioc period duration.

* Usage threshold is raised to 50%. Combined with the preceding changes and
  the switch to average usage, this makes debt forgivness a lot more
  effective at reducing the amount of unnecessary idleness.

* Constants are renamed with DFGV_ prefix.

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