blk-wbt: fix performance regression in wbt scale_up/scale_down
authorHarshad Shirwadkar <harshadshirwadkar@gmail.com>
Sat, 5 Oct 2019 18:59:27 +0000 (11:59 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2019 20:45:16 +0000 (13:45 -0700)
commit345c03a0defb07505c3c099bf68f30187f00dae2
treeb24e895a096ca94115ee4f4f7a09f3ab3cfbbd12
parentd855a5f2dec7d2f48a7270abf92dfb3a46b5a581
blk-wbt: fix performance regression in wbt scale_up/scale_down

commit b84477d3ebb96294f87dc3161e53fa8fe22d9bfd upstream.

scale_up wakes up waiters after scaling up. But after scaling max, it
should not wake up more waiters as waiters will not have anything to
do. This patch fixes this by making scale_up (and also scale_down)
return when threshold is reached.

This bug causes increased fdatasync latency when fdatasync and dd
conv=sync are performed in parallel on 4.19 compared to 4.14. This
bug was introduced during refactoring of blk-wbt code.

Fixes: a79050434b45 ("blk-rq-qos: refactor out common elements of blk-wbt")
Cc: stable@vger.kernel.org
Cc: Josef Bacik <jbacik@fb.com>
Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/blk-rq-qos.c
block/blk-rq-qos.h
block/blk-wbt.c