From patchwork Wed Jan 10 16:33:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10155613 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 2BCD0602D8 for ; Wed, 10 Jan 2018 16:33:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DAA026255 for ; Wed, 10 Jan 2018 16:33:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12381284AF; Wed, 10 Jan 2018 16:33:37 +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 838AE26255 for ; Wed, 10 Jan 2018 16:33:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932430AbeAJQdf (ORCPT ); Wed, 10 Jan 2018 11:33:35 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:3039 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933445AbeAJQde (ORCPT ); Wed, 10 Jan 2018 11:33:34 -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=1515602014; x=1547138014; h=from:to:cc:subject:date:message-id; bh=vN6VwnUC1m9qf8asQ4/lPyv/06E+a8pXhBVz1qXjvmw=; b=dZ1FV+hpZA5uul31tovkR9GduN1iS09GoYJk8cRH8gv/XIdO4Ct7/KvV iaEqztJIEtZya1noHFYkPr3tGYdzLOMTzC6QuDyOOgZt5DT/5+WlvQrTN mcvksZwZI9bWOjxTtVAuUWyBEnrWUvRJP34vT/duX7Zpa3dRiw16Juuk7 1M6UbyWqaMI0BiLDjyoKy99nY4AcDiJUBr7Yv8cmg6yvOE34DfkNvudEO 0TPiTaDPALKlZ4qJnLg2lJEX7udiM5gZK3l7aCGhhdEnz+6YrJt8NOIrI 8rPJCHDglneeAoRMgZqd9lGuxj+JQJW/z2VrXu7PNdfiv7h5qVV8HJiIS Q==; X-IronPort-AV: E=Sophos;i="5.46,341,1511798400"; d="scan'208";a="171211671" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 11 Jan 2018 00:33:34 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 10 Jan 2018 08:29:06 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip02.wdc.com with ESMTP; 10 Jan 2018 08:33:34 -0800 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Hannes Reinecke , Johannes Thumshirn Subject: [PATCH] blk-mq: Explain when 'active_queues' is decremented Date: Wed, 10 Jan 2018 08:33:33 -0800 Message-Id: <20180110163333.14345-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.15.1 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 It is nontrivial to derive from the blk-mq source code when blk_mq_tags.active_queues is decremented. Hence add a comment that explains this. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn --- block/blk-mq.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/block/blk-mq.c b/block/blk-mq.c index 9aa24c9508f9..266fc4f6b046 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -954,6 +954,12 @@ static void blk_mq_timeout_work(struct work_struct *work) data.next = blk_rq_timeout(round_jiffies_up(data.next)); mod_timer(&q->timeout, data.next); } else { + /* + * Request timeouts are handled as a forward rolling timer. If + * we end up here it means that no requests are pending and + * also that no request has been pending for a while. Mark + * each hctx as idle. + */ queue_for_each_hw_ctx(q, hctx, i) { /* the hctx may be unmapped, so check it here */ if (blk_mq_hw_queue_mapped(hctx))