From patchwork Fri Dec 1 00:08:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10085881 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E9F956064F for ; Fri, 1 Dec 2017 00:08:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBBAA2A447 for ; Fri, 1 Dec 2017 00:08:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA5AC2A44B; Fri, 1 Dec 2017 00:08:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66A762A447 for ; Fri, 1 Dec 2017 00:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751354AbdLAAIw (ORCPT ); Thu, 30 Nov 2017 19:08:52 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:23712 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750890AbdLAAIu (ORCPT ); Thu, 30 Nov 2017 19:08:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1512086932; x=1543622932; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=ZAvxmKjXPx/WoYxHYq8Faz6a5tWvb6i7ND6VBLAcDPg=; b=TVG+vkEW3b9wI0P8hI11Oxu+Pb1nnZwUUmhqxlQSFwtYaeOsfaa+Uhpu Q2FQzE26rbDZ3AorvViu8fpjNEwRrIlQl6QMVHkyKfVs9sZdb0mB+Fc85 KIXW5fpP+vxZ0nPswg/Jd85L/To8bxHNEMCXPspJNizxQiC53tG+E+IFd X1WimeVK/Ck+OisAJLgedTxvUoat00lP9PnVbFlngAyvFXd3WxOU4dfQs NHgZi7SDEdcvUfIzMEU2QqCAsk4S4WwhdXuJBt79fT2WMA3aWe/9/eScr 7Y/oc102BJcDsLzZxmZ3xL3I/2Y53VyqhYbbkW3JN5XZ+hnuTCdcBJ1Az w==; X-IronPort-AV: E=Sophos;i="5.45,343,1508774400"; d="scan'208";a="63876008" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 01 Dec 2017 08:08:51 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 30 Nov 2017 16:06:07 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.166.51]) by uls-op-cesaip02.wdc.com with ESMTP; 30 Nov 2017 16:08:50 -0800 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Ming Lei , Omar Sandoval , Hannes Reinecke , Johannes Thumshirn Subject: [PATCH 5/7] blk-mq: Avoid that blk_mq_mark_tag_wait() triggers a queue stall Date: Thu, 30 Nov 2017 16:08:46 -0800 Message-Id: <20171201000848.2656-6-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171201000848.2656-1-bart.vanassche@wdc.com> References: <20171201000848.2656-1-bart.vanassche@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The blk_mq_sched_restart() call from inside blk_mq_free_request() only runs those queues for which BLK_MQ_S_SCHED_RESTART has been set. Hence set that flag from inside blk_mq_mark_tag_wait() whether or not a queue is shared. Signed-off-by: Bart Van Assche Cc: Ming Lei Cc: Omar Sandoval Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- block/blk-mq-sched.c | 2 +- block/blk-mq.c | 4 ++-- block/blk-mq.h | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index c4e0cb5f6f1f..398545d94521 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -54,7 +54,7 @@ void blk_mq_sched_assign_ioc(struct request *rq, struct bio *bio) * Mark a hardware queue as needing a restart. For shared queues, maintain * a count of how many hardware queues are marked for restart. */ -static void blk_mq_sched_mark_restart_hctx(struct blk_mq_hw_ctx *hctx) +void blk_mq_sched_mark_restart_hctx(struct blk_mq_hw_ctx *hctx) { if (test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) return; diff --git a/block/blk-mq.c b/block/blk-mq.c index 26fec4dfa40f..3e0ce940377f 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1036,9 +1036,9 @@ static bool blk_mq_mark_tag_wait(struct blk_mq_hw_ctx **hctx, wait_queue_entry_t *wait; bool ret; + blk_mq_sched_mark_restart_hctx(this_hctx); + if (!shared_tags) { - if (!test_bit(BLK_MQ_S_SCHED_RESTART, &this_hctx->state)) - set_bit(BLK_MQ_S_SCHED_RESTART, &this_hctx->state); ret = blk_mq_get_driver_tag(rq, hctx, false); /* * Don't clear RESTART here, someone else could have set it. diff --git a/block/blk-mq.h b/block/blk-mq.h index 6c7c3ff5bf62..eb3c93aeb8b3 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -139,6 +139,8 @@ static inline bool blk_mq_hw_queue_mapped(struct blk_mq_hw_ctx *hctx) void blk_mq_in_flight(struct request_queue *q, struct hd_struct *part, unsigned int inflight[2]); +void blk_mq_sched_mark_restart_hctx(struct blk_mq_hw_ctx *hctx); + static inline void blk_mq_put_dispatch_budget(struct blk_mq_hw_ctx *hctx) { struct request_queue *q = hctx->queue;