Received: by 10.223.148.5 with SMTP id 5csp6855827wrq; Wed, 17 Jan 2018 20:36:57 -0800 (PST) X-Google-Smtp-Source: ACJfBotF6zI426o55gyCMVvxHVg1ZT++W09S0suxQO35grmxUTDkBPaoWyXcWC84/PddJTvbu+RO X-Received: by 10.84.150.129 with SMTP id h1mr43806057plh.369.1516250217830; Wed, 17 Jan 2018 20:36:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516250217; cv=none; d=google.com; s=arc-20160816; b=mdpseIwn/Z1yqtFHHqQFUgVrIfE2/wXPRhQJFgAoDE/kN30NGDkrOnm18fQ8pioOB5 pMYUjUai3ZgJfa9oVUNsVYLQZ/SgqfzpF7NBBmxVnA4EJ60Mu8sDIzS2F5rgfis7cOtS FMaZkP81iv40Gt9Q7zRYH0XdHgJAzo7tXwjDKgqg6VKdb7mCyAm/LJ7IgWeqJy9hy44P M0FU5w92EMlGSNzKRisa4bj9gA0RYB4ouDemgJLFzSdGJ0H+Zsb0R1f2luo83+frc5x5 UewMHH35moC+KecCTj3dRjsdmgDSOX1HmHdPnBgcYdc64Lbk41uokbtMNV6JoBSChy9l ao5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=B/+mlmBQC4jBR3RHrpWnFpBUs8m1A5nXQoxC2ca2us0=; b=RnHbTgHPbvSx7EcqO/361QYQJUtfC1j5lEa0QmhU7v5sLoxzsZUxF1i0OdcIXp7q8v 2eegqzJ0hXgi6hrtZzGfVKbzHN0moyaJbA3OOscBBLm0LdCLG6SShQS1IbSkNk/KL3H6 sTMczSNPIbufpIKnAbVjdTWDZONa7G+C2dCrW/3mBFD/SSLAtkiv4yBLwWjPaBYP4oJM Yc8DMSAkKSqL3zqeKIfWrjQJEVYTe+LsR7jfZgpPJK7BnRaZKIruQUBbJsuawjdIS15M UREiaGEHNQdI1mAcrKHhSHAyUSWivtlLuXRXahxkL6z5Cin+8DNDon7oIbgG+ek0xBwF 6sVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si5135697pgu.783.2018.01.17.20.36.43; Wed, 17 Jan 2018 20:36:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753956AbeAREgT (ORCPT + 99 others); Wed, 17 Jan 2018 23:36:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33694 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752184AbeAREgR (ORCPT ); Wed, 17 Jan 2018 23:36:17 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8949E61460; Thu, 18 Jan 2018 04:36:17 +0000 (UTC) Received: from localhost (unknown [10.18.25.149]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76A525C8AF; Thu, 18 Jan 2018 04:36:10 +0000 (UTC) Date: Wed, 17 Jan 2018 23:36:09 -0500 From: Mike Snitzer To: Ming Lei Cc: Jens Axboe , linux-block@vger.kernel.org, dm-devel@redhat.com, Christoph Hellwig , Bart Van Assche , linux-kernel@vger.kernel.org Subject: Re: blk-mq: don't dispatch request in blk_mq_request_direct_issue if queue is busy Message-ID: <20180118043608.GA8809@redhat.com> References: <20180118040659.20202-1-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180118040659.20202-1-ming.lei@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 18 Jan 2018 04:36:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 17 2018 at 11:06pm -0500, Ming Lei wrote: > If we run into blk_mq_request_direct_issue(), when queue is busy, we > don't want to dispatch this request into hctx->dispatch_list, and > what we need to do is to return the queue busy info to caller, so > that caller can deal with it well. > > Fixes: 396eaf21ee ("blk-mq: improve DM's blk-mq IO merging via blk_insert_cloned_request feedback") > Reported-by: Laurence Oberman > Reviewed-by: Mike Snitzer > Signed-off-by: Ming Lei > --- > block/blk-mq.c | 22 ++++++++++------------ > 1 file changed, 10 insertions(+), 12 deletions(-) > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index 4d4af8d712da..1af7fa70993b 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -1856,15 +1856,6 @@ static blk_status_t __blk_mq_issue_directly(struct blk_mq_hw_ctx *hctx, > return ret; > } > > -static void __blk_mq_fallback_to_insert(struct request *rq, > - bool run_queue, bool bypass_insert) > -{ > - if (!bypass_insert) > - blk_mq_sched_insert_request(rq, false, run_queue, false); > - else > - blk_mq_request_bypass_insert(rq, run_queue); > -} > - > static blk_status_t __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, > struct request *rq, > blk_qc_t *cookie, > @@ -1873,9 +1864,16 @@ static blk_status_t __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, > struct request_queue *q = rq->q; > bool run_queue = true; > > - /* RCU or SRCU read lock is needed before checking quiesced flag */ > + /* > + * RCU or SRCU read lock is needed before checking quiesced flag. > + * > + * When queue is stopped or quiesced, ignore 'bypass_insert' from > + * blk_mq_request_direct_issue(), and return BLK_STS_OK to caller, > + * and avoid driver to try to dispatch again. > + */ > if (blk_mq_hctx_stopped(hctx) || blk_queue_quiesced(q)) { > run_queue = false; > + bypass_insert = false; > goto insert; > } > > @@ -1892,10 +1890,10 @@ static blk_status_t __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, > > return __blk_mq_issue_directly(hctx, rq, cookie); > insert: > - __blk_mq_fallback_to_insert(rq, run_queue, bypass_insert); > if (bypass_insert) > return BLK_STS_RESOURCE; > > + blk_mq_sched_insert_request(rq, false, run_queue, false); > return BLK_STS_OK; > } OK so you're just leveraging blk_mq_sched_insert_request()'s ability to resort to__blk_mq_insert_request() if !q->elevator.