Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8269784ybi; Tue, 23 Jul 2019 05:48:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEDlQwUIJSYbdF5Z3tsg1vu6HX5mgjhn0g5oQxbw2osCMORF9D4n+7paaaP12Z0dQ36yW1 X-Received: by 2002:a17:902:42a5:: with SMTP id h34mr82993067pld.16.1563886132232; Tue, 23 Jul 2019 05:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563886132; cv=none; d=google.com; s=arc-20160816; b=o9XN9t18SqQB9rnYxbAKf37FhEAtv1joW9AUTO4eEBy0qz9AZZICO6BjaUyqgcQmxd WfcMsDkNw8hZa5NJOoPSP9zXCOaNu3xv4DtupxRpLdTUeSPefApXl4tZ79lXJsy4/dl4 teeINof6RqRfo13YblP7dZ9A5bzupDlHIV4ZdOuT6LOEA2NonqQYPNCJ3wKnu9oc7fEj p4ZhS+/8Gc1+d2wDC2zRMVROjCFHHHOV82RD3ZVneo1IuBQk94nlBwi131uWougnOk1c 2K7NotOqD35r8Fble4vFl7aVAIkw3YP0CxYqLW9wIwhL45LQqZfQysP6FOtOMqOYDo+F 5zeg== 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; bh=TsCf9jHvn7BMWbnjB4EG7UkG9xygecEwaGh1cDuvBfU=; b=NAGbtBpFqfngG4ipt6Jdssp6yndCxaa0wXmqXenYxGx+Hi98DxsVYic4/8vOEPObSj sznTeQIJ7mVMLLneyVZcjjzH4q00Mwjj5liJQVvmkWtShTK1LvewLMjwQGRF9hqUxPeA xEtFldYca8CAr8m8BtC5fgbdjbAffgo6+dr5U7LDQ5CpgPjocIKRs4PERg4Rm1/DSki3 xESmKBKx8YFcLRNN7qT7ohndhFeVewBRT11t7+vOqNbZagzCRIVZyEvzr9kvndEwmxKJ bUad1CVgijQMLHSvDd1Nqehz0sDEOjALap+/tU7qzgg+xSpoycRqQYZL1ShxPYLDq4wX acng== 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 w1si9091735pgg.400.2019.07.23.05.48.36; Tue, 23 Jul 2019 05:48:52 -0700 (PDT) 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 S1731442AbfGWDbU (ORCPT + 99 others); Mon, 22 Jul 2019 23:31:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36436 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731320AbfGWDbT (ORCPT ); Mon, 22 Jul 2019 23:31:19 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 336FF3082A49; Tue, 23 Jul 2019 03:31:19 +0000 (UTC) Received: from ming.t460p (ovpn-8-21.pek2.redhat.com [10.72.8.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B6AC19C6A; Tue, 23 Jul 2019 03:31:09 +0000 (UTC) Date: Tue, 23 Jul 2019 11:31:04 +0800 From: Ming Lei To: Baolin Wang Cc: Jens Axboe , Adrian Hunter , Ulf Hansson , Chunyan Zhang , Orson Zhai , Arnd Bergmann , Linus Walleij , Vincent Guittot , linux-mmc , LKML , linux-block@vger.kernel.org Subject: Re: [RFC PATCH 1/7] blk-mq: Export blk_mq_hctx_has_pending() function Message-ID: <20190723033103.GA13829@ming.t460p> References: <94a0d20e6304b909391abd9a425c71c376cad964.1563782844.git.baolin.wang@linaro.org> <20190722141940.GA26528@ming.t460p> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 23 Jul 2019 03:31:19 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 23, 2019 at 11:12:57AM +0800, Baolin Wang wrote: > Hi Ming, > > On Mon, 22 Jul 2019 at 22:19, Ming Lei wrote: > > > > On Mon, Jul 22, 2019 at 09:09:36PM +0800, Baolin Wang wrote: > > > 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. And this patch set will introduce MMC packed function > > > to support this feature by following patches. > > > > > > To support MMC packed function, the MMC layer need to know if there are > > > requests are pending now in hardware queue to help to combine requests > > > as much as possible. If we know there are requests pending in hardware > > > queue, then we should not package requests to host controller immediately, > > > instead we should collect more requests into MMC packed queue to be packed > > > to host controller with packed condition. > > > > > > Thus export this function for MMC packed function. > > > > > > Signed-off-by: Baolin Wang > > > --- > > > block/blk-mq.c | 3 ++- > > > include/linux/blk-mq.h | 1 + > > > 2 files changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/block/blk-mq.c b/block/blk-mq.c > > > index b038ec6..5bd4ef9 100644 > > > --- a/block/blk-mq.c > > > +++ b/block/blk-mq.c > > > @@ -63,12 +63,13 @@ static int blk_mq_poll_stats_bkt(const struct request *rq) > > > * Check if any of the ctx, dispatch list or elevator > > > * have pending work in this hardware queue. > > > */ > > > -static bool blk_mq_hctx_has_pending(struct blk_mq_hw_ctx *hctx) > > > +bool blk_mq_hctx_has_pending(struct blk_mq_hw_ctx *hctx) > > > { > > > return !list_empty_careful(&hctx->dispatch) || > > > sbitmap_any_bit_set(&hctx->ctx_map) || > > > blk_mq_sched_has_work(hctx); > > > } > > > +EXPORT_SYMBOL_GPL(blk_mq_hctx_has_pending); > > > > Just wondering why you don't use the 'last' field of 'struct blk_mq_queue_data', > > which is passed to .queue_rq(), and supposed for implementing batch submission. > > The 'last' field of 'struct blk_mq_queue_data' does not indicate the > last request in the hardware queue, since we want to collect more > requests from block layer as much as possible to be packed later. > > And from blk_mq_do_dispatch_sched()--->blk_mq_dispatch_rq_list()---> > queue_rq(), I always get 'bd.last = true', which is not useful to > combine requests for MMC packed queue. Maybe I missed anything? That is one flaw of current implementation, and we may improve it, so other drivers(virtio-io, ...) can benefit from it too. Thanks, Ming