linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang7@gmail.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: axboe@kernel.dk, Ulf Hansson <ulf.hansson@linaro.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Linus Walleij <linus.walleij@linaro.org>,
	Paolo Valente <paolo.valente@linaro.org>,
	Ming Lei <ming.lei@redhat.com>, Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	linux-block <linux-block@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v2 1/7] block: Extand commit_rqs() to do batch processing
Date: Tue, 28 Apr 2020 16:02:33 +0800	[thread overview]
Message-ID: <CADBw62qrM2pjDXVGumTDsjvbNwN9S3kexxZemqkCf2JBynDOmQ@mail.gmail.com> (raw)
In-Reply-To: <20200427154645.GA1201@infradead.org>

On Mon, Apr 27, 2020 at 11:46 PM Christoph Hellwig <hch@infradead.org> wrote:
>
> extand in the subject really shpuld be 'extend'

Sorry for typo, and will fix in next version.

>
> On Sun, Apr 26, 2020 at 05:38:54PM +0800, Baolin Wang wrote:
> > From: Ming Lei <ming.lei@redhat.com>
> >
> > 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 <ming.lei@redhat.com>
> > Tested-by: Baolin Wang <baolin.wang7@gmail.com>
> > Signed-off-by: Baolin Wang <baolin.wang7@gmail.com>
> > ---
> >  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.

Thanks for pointing this out, and seems I should re-modify the return
values of the functions.

>
> > +             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);
>                 }

Yes, looks better.

> > 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

Looks reasonable to me, and will do.

> flag (just like the existing ones..) could really use a comment
> explaining it.

OK, will add some comments. Thanks for your comments.

-- 
Baolin Wang

  reply	other threads:[~2020-04-28  8:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26  9:38 [RFC PATCH v2 0/7] Add MMC packed request support Baolin Wang
2020-04-26  9:38 ` [RFC PATCH v2 1/7] block: Extand commit_rqs() to do batch processing Baolin Wang
2020-04-27 15:46   ` Christoph Hellwig
2020-04-28  8:02     ` Baolin Wang [this message]
2020-05-08 21:35     ` Sagi Grimberg
2020-05-08 21:46       ` Ming Lei
2020-05-08 22:19         ` Sagi Grimberg
2020-05-08 23:22           ` Ming Lei
2020-05-09  8:57             ` Baolin Wang
2020-05-09  9:43               ` Ming Lei
2020-05-10  7:44                 ` Sagi Grimberg
2020-05-11  1:29                   ` Ming Lei
2020-05-11  9:23                     ` Sagi Grimberg
2020-05-11 11:47                       ` Ming Lei
2020-05-12  6:26                         ` Sagi Grimberg
2020-05-12  7:55                           ` Ming Lei
2020-04-26  9:38 ` [RFC PATCH v2 2/7] mmc: Add MMC packed request support for MMC software queue Baolin Wang
2020-04-26  9:38 ` [RFC PATCH v2 3/7] mmc: host: sdhci: Introduce ADMA3 transfer mode Baolin Wang
2020-04-26  9:38 ` [RFC PATCH v2 4/7] mmc: host: sdhci: Factor out the command configuration Baolin Wang
2020-04-26  9:38 ` [RFC PATCH v2 5/7] mmc: host: sdhci: Remove redundant sg_count member of struct sdhci_host Baolin Wang
2020-04-26  9:38 ` [RFC PATCH v2 6/7] mmc: host: sdhci: Add MMC packed request support Baolin Wang
2020-04-26  9:39 ` [RFC PATCH v2 7/7] mmc: host: sdhci-sprd: " Baolin Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADBw62qrM2pjDXVGumTDsjvbNwN9S3kexxZemqkCf2JBynDOmQ@mail.gmail.com \
    --to=baolin.wang7@gmail.com \
    --cc=adrian.hunter@intel.com \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=orsonzhai@gmail.com \
    --cc=paolo.valente@linaro.org \
    --cc=ulf.hansson@linaro.org \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).