summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-08-18 23:55:19 +0200
committerJens Axboe <axboe@fb.com>2015-08-19 00:49:17 +0200
commitc9589f03e490956628ff91a1da133216dc796b63 (patch)
tree688cec558495fd27078e34d5474992b5c2b6650f /block
parentblkcg: move root blkg lookup optimization from throtl_lookup_tg() to __blkg_l... (diff)
downloadlinux-c9589f03e490956628ff91a1da133216dc796b63.tar.xz
linux-c9589f03e490956628ff91a1da133216dc796b63.zip
blk-throttle: improve queue bypass handling
If a queue is bypassing, all blkcg policies should become noops but blk-throttle wasn't. It only became noop if the queue was dying. While this wouldn't lead to an oops as falling back to the root blkg is safe in this case, this can be a bit surprising - a bypassing queue could still be applying throttle limits. Fix it by removing blk_queue_dying() test in throtl_lookup_create_tg() and testing blk_queue_bypass() in blk_throtl_bio() and bypassing before doing anything else. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Vivek Goyal <vgoyal@redhat.com> Cc: Arianna Avanzini <avanzini.arianna@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-throttle.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 1f63fc834dc3..900a777e01c2 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -475,7 +475,7 @@ static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
/* if %NULL and @q is alive, fall back to root_tg */
if (!IS_ERR(blkg))
tg = blkg_to_tg(blkg);
- else if (!blk_queue_dying(q))
+ else
tg = td_root_tg(td);
}
@@ -1438,10 +1438,11 @@ bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
* IO group
*/
spin_lock_irq(q->queue_lock);
- tg = throtl_lookup_create_tg(td, blkcg);
- if (unlikely(!tg))
+
+ if (unlikely(blk_queue_bypass(q)))
goto out_unlock;
+ tg = throtl_lookup_create_tg(td, blkcg);
sq = &tg->service_queue;
while (true) {