Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3034481ybz; Mon, 27 Apr 2020 08:51:00 -0700 (PDT) X-Google-Smtp-Source: APiQypIrjzJG2GEOqgnMtihzL9AvK+y6nMKK5y/6gs1JEIYk1nPf2RoUU3TZPb2Yc3n5dg1huSoQ X-Received: by 2002:aa7:d513:: with SMTP id y19mr19729098edq.367.1588002660198; Mon, 27 Apr 2020 08:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588002660; cv=none; d=google.com; s=arc-20160816; b=HdZfU1vd2+Q9deqUuzcsjQnapsJp23zqMQc80Au2FB6sk4F+aLyoLgMzdw5ChO7Iss Ll7yi0DMb/oGa2liqE51PXLsoROxwDI1G2CSDEaAp5J32iD+t7w+fUoIGB5eZ4xQG8jA i1n1shcdW5rESCfkku9aYCkXSdlS5J4J1EFB4FgXB9UiLYfiTMh9ljKGG4w2IPssBfoU QWDBsL24FHJ/nw4poeSwCE1niqiFNYSZocbM76FHpoS8vbUBRDSYpyUbYJcA17xlNQkf NMpM35VeOfymNDlk7gBFZGiN0CJfY0JfHO35XKLQBjv5sLkW5qeqraKL5b/2NooVnM/w L74Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=WJhX0gy4PLhLVzhkqKlPTRBI4F1++Yw2mgGmpA3PmDk=; b=HFOJTOpl67PyBvyAw6umTBdkH7zgL5k2frB+ddF/o9ouFJi/WuYJvhbeNTgs5UCFo4 pTtZZeoz5y9SAk3tbsjDW5QIcj1RUjqDJdlriY3BWTf4aveYNn9QqKQbjC8z8OkbET4v Ni4Un1Oi9woXSntX8683U7LsOEQh+MSt4fyk/Ug5WdlhizUVvAXA+ncjiuOT7MlM78y8 zWHmptYZvXQ1wnPyyHW01+xAuXWkqLhjljp9iyN+2RNboixfKgw4/VN574ZoC8ZRNE9M cFuAikvwn5BAQFmmydVvKEzLhEmWpHeG2lGtoOZ17eJxxhdOeGH1M15wPxvEGOsykeQg qmqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="Rv9xl/0y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h22si9016533ejq.363.2020.04.27.08.50.36; Mon, 27 Apr 2020 08:51:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="Rv9xl/0y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728172AbgD0Pqy (ORCPT + 99 others); Mon, 27 Apr 2020 11:46:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727077AbgD0Pqy (ORCPT ); Mon, 27 Apr 2020 11:46:54 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6973AC0610D5; Mon, 27 Apr 2020 08:46:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=WJhX0gy4PLhLVzhkqKlPTRBI4F1++Yw2mgGmpA3PmDk=; b=Rv9xl/0yJAvArM66lMVoxSWEMQ 3Qh/ze4bgZMsEwvC5UUATGsA9ndC2ScJuPNo9xuctTBXRJo5vw9hJsy620rzuA+6fG7N0rMSJ4Ldg 57nntPN3w9G49xjrPcPPxzMKCxNlEAe5dlw5t04X/s4HsA/6UOTAAMAeik+Qz2XZPrxeEtp82fUtt Jr7x3NcjgEjOVQnZyTTB8P0XwdhKAspRZ7sD9Td1qDK8ZIHp/jaGQ8LcNHFsUPCbu+Gtxz6TKMbAK Awqyk3g/bsIaq4woSAzA3r6HJ5HmKsRwiyhFjY3dYtVOjI2t6CgFPy+oSNkQmF0hMXalSzMCMHzK4 8GhNKZnw==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jT5y1-0007q0-PV; Mon, 27 Apr 2020 15:46:45 +0000 Date: Mon, 27 Apr 2020 08:46:45 -0700 From: Christoph Hellwig To: Baolin Wang Cc: axboe@kernel.dk, ulf.hansson@linaro.org, adrian.hunter@intel.com, arnd@arndb.de, linus.walleij@linaro.org, paolo.valente@linaro.org, ming.lei@redhat.com, orsonzhai@gmail.com, zhang.lyra@gmail.com, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 1/7] block: Extand commit_rqs() to do batch processing Message-ID: <20200427154645.GA1201@infradead.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org extand in the subject really shpuld be 'extend' On Sun, Apr 26, 2020 at 05:38:54PM +0800, Baolin Wang wrote: > From: Ming Lei > > Now some SD/MMC host controllers can support packed command or packed request, > that means we can package several requests to host controller at one time > to improve performence. > > But the blk-mq always takes one request from the scheduler and dispatch it to > the device, regardless of the driver or the scheduler, so there should only > ever be one request in the local list in blk_mq_dispatch_rq_list(), that means > the bd.last is always true and the driver can not use bd.last to decide if > there are requests are pending now in hardware queue to help to package > requests. > > Thus this patch introduces a new 'BLK_MQ_F_FORCE_COMMIT_RQS' flag to call > .commit_rqs() to do batch processing if necessary. > > Signed-off-by: Ming Lei > Tested-by: Baolin Wang > Signed-off-by: Baolin Wang > --- > block/blk-mq-sched.c | 29 ++++++++++++++++++++--------- > block/blk-mq.c | 15 ++++++++++----- > include/linux/blk-mq.h | 1 + > 3 files changed, 31 insertions(+), 14 deletions(-) > > diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c > index 74cedea56034..3429a71a7364 100644 > --- a/block/blk-mq-sched.c > +++ b/block/blk-mq-sched.c > @@ -85,11 +85,12 @@ void blk_mq_sched_restart(struct blk_mq_hw_ctx *hctx) > * its queue by itself in its completion handler, so we don't need to > * restart queue if .get_budget() returns BLK_STS_NO_RESOURCE. > */ > -static void blk_mq_do_dispatch_sched(struct blk_mq_hw_ctx *hctx) > +static bool blk_mq_do_dispatch_sched(struct blk_mq_hw_ctx *hctx) This function already returns an int in the current for-5.8/block tree. > + if (!(hctx->flags & BLK_MQ_F_FORCE_COMMIT_RQS)) { > + if (list_empty(list)) { > + bd.last = true; > + } else { > + nxt = list_first_entry(list, struct request, > + queuelist); > + bd.last = !blk_mq_get_driver_tag(nxt); > + } > + } else { > + bd.last = false; > } This seems a little odd in terms of code flow. Why not: if (hctx->flags & BLK_MQ_F_FORCE_COMMIT_RQS) { bd.last = false; } else if (list_empty(list)) { bd.last = true; } else { nxt = list_first_entry(list, struct request, queuelist); bd.last = !blk_mq_get_driver_tag(nxt); } > diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h > index f389d7c724bd..6a20f8e8eb85 100644 > --- a/include/linux/blk-mq.h > +++ b/include/linux/blk-mq.h > @@ -391,6 +391,7 @@ struct blk_mq_ops { > enum { > BLK_MQ_F_SHOULD_MERGE = 1 << 0, > BLK_MQ_F_TAG_SHARED = 1 << 1, > + BLK_MQ_F_FORCE_COMMIT_RQS = 1 << 3, Maybe BLK_MQ_F_ALWAYS_COMMIT might be a better name? Also this flag (just like the existing ones..) could really use a comment explaining it.