FROMLIST: blk-wbt: fix performance regression in wbt scale_up/scale_down

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: Josef Bacik <jbacik@fb.com>
Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
(am from https://lore.kernel.org/patchwork/patch/1135590/)
Signed-off-by: Vaibhav Rustagi <vaibhavrustagi@google.com>

BUG=b:141549992
TEST=tested on repro defined in b/141549992
RELEASE_NOTE=None

Change-Id: Iaf247b5ffecfdfb1d7083e56ed1fecab5229cd0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1842300
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Robert Kolchmeyer <rkolchmeyer@google.com>
Reviewed-by: Harshad Shirwadkar <harshads@google.com>
Commit-Queue: Vaibhav Rustagi <vaibhavrustagi@google.com>
Tested-by: Vaibhav Rustagi <vaibhavrustagi@google.com>
3 files changed