This is a note to let you know that I've just added the patch titled blk-iocost: clamp inuse and skip noops in __propagate_weights() to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: blk-iocost-clamp-inuse-and-skip-noops-in-__propagate.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 067fe0a9230c01e1b8fae56fa64133abb3b9f8ba Author: Tejun Heo <tj@xxxxxxxxxx> Date: Tue Sep 1 14:52:35 2020 -0400 blk-iocost: clamp inuse and skip noops in __propagate_weights() [ Upstream commit db84a72af6be422abf2089a5896293590dda5066 ] __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@xxxxxxxxxx> Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Stable-dep-of: 57e420c84f9a ("blk-iocost: Avoid using clamp() on inuse in __propagate_weights()") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/block/blk-iocost.c b/block/blk-iocost.c index e7d5aafa5e99..75eb90b3241e 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -907,7 +907,10 @@ static void __propagate_active_weight(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];