aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-throttle.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2020-09-14 11:05:13 -0400
committerJens Axboe <axboe@kernel.dk>2020-09-14 17:25:39 -0600
commitaa67db24b6761277d731cc3434420283479927ca (patch)
treed0f2619c33c90a1f333b3d67e65a4f23d133cf91 /block/blk-throttle.c
parentblk-iocost: fix divide-by-zero in transfer_surpluses() (diff)
downloadlinux-dev-aa67db24b6761277d731cc3434420283479927ca.tar.xz
linux-dev-aa67db24b6761277d731cc3434420283479927ca.zip
iocost: fix infinite loop bug in adjust_inuse_and_calc_cost()
adjust_inuse_and_calc_cost() is responsible for reducing the amount of donated weights dynamically in period as the budget runs low. Because we don't want to do full donation calculation in period, we keep latching up inuse by INUSE_ADJ_STEP_PCT of the active weight of the cgroup until the resulting hweight_inuse is satisfactory. Unfortunately, the adj_step calculation was reading the active weight before acquiring ioc->lock. Because the current thread could have lost race to activate the iocg to another thread before entering this function, it may read the active weight as zero before acquiring ioc->lock. When this happens, the adj_step is calculated as zero and the incremental adjustment loop becomes an infinite one. Fix it by fetching the active weight after acquiring ioc->lock. Fixes: b0853ab4a238 ("blk-iocost: revamp in-period donation snapbacks") Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-throttle.c')
0 files changed, 0 insertions, 0 deletions