aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-iocost.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2020-09-01 14:52:35 -0400
committerJens Axboe <axboe@kernel.dk>2020-09-01 19:38:31 -0600
commitdb84a72af6be422abf2089a5896293590dda5066 (patch)
tree015107e8a4c471aa1fd872043d096ea39c835617 /block/blk-iocost.c
parentblk-iocost: rename propagate_active_weights() to propagate_weights() (diff)
downloadlinux-dev-db84a72af6be422abf2089a5896293590dda5066.tar.xz
linux-dev-db84a72af6be422abf2089a5896293590dda5066.zip
blk-iocost: clamp inuse and skip noops in __propagate_weights()
__propagate_weights() currently expects the callers to clamp inuse within [1, active], which is needlessly fragile. The inuse adjustment logic is going to be revamped, in preparation, let's make __propagate_weights() clamp inuse on entry. Also, make it avoid weight updates altogether if neither active or inuse is changed. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-iocost.c')
-rw-r--r--block/blk-iocost.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 78e6919153d8..8dfe73dde2a8 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -897,7 +897,10 @@ static void __propagate_weights(struct ioc_gq *iocg, u32 active, u32 inuse)
lockdep_assert_held(&ioc->lock);
- inuse = min(active, inuse);
+ inuse = clamp_t(u32, inuse, 1, active);
+
+ if (active == iocg->active && inuse == iocg->inuse)
+ return;
for (lvl = iocg->level - 1; lvl >= 0; lvl--) {
struct ioc_gq *parent = iocg->ancestors[lvl];