From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752089AbbGLSCb (ORCPT ); Sun, 12 Jul 2015 14:02:31 -0400 Received: from mail-yk0-f195.google.com ([209.85.160.195]:33357 "EHLO mail-yk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751339AbbGLSAv (ORCPT ); Sun, 12 Jul 2015 14:00:51 -0400 From: Tejun Heo To: axboe@kernel.dk Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, vgoyal@redhat.com, avanzini.arianna@gmail.com, Tejun Heo Subject: [PATCH 04/10] blk-throttle: improve queue bypass handling Date: Sun, 12 Jul 2015 14:00:37 -0400 Message-Id: <1436724043-12986-5-git-send-email-tj@kernel.org> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1436724043-12986-1-git-send-email-tj@kernel.org> References: <1436724043-12986-1-git-send-email-tj@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Vivek Goyal Cc: Arianna Avanzini --- block/blk-throttle.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 1f63fc8..900a777 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) { -- 2.4.3