From: Christoph Hellwig <hch@infradead.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@fb.com>,
linux-block@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>,
Omar Sandoval <osandov@fb.com>
Subject: Re: [PATCH] blk-mq: provide a default .bio_merge
Date: Sat, 20 May 2017 23:30:59 -0700 [thread overview]
Message-ID: <20170521063059.GA23777@infradead.org> (raw)
In-Reply-To: <20170512162054.25517-1-ming.lei@redhat.com>
On Sat, May 13, 2017 at 12:20:54AM +0800, Ming Lei wrote:
> Before blk-mq is introduced, I/O is merged before putting into
> plug queue, but blk-mq changed the order and makes merging
> basically impossible until mq-deadline is introduced. Then it
> is observed that throughput of sequential I/O is degraded about
> 10%~20% on virtio-blk in the test[1] if IO schedluer isn't used.
>
> This patch provides a default per-sw-queue bio merging if there
> isn't scheduler enabled or the scheduler hasn't implement .bio_merge(),
> and this way actually moves merging before plugging just
> like what blk_queue_bio() does, then the performance regression
> is fixed.
This looks generally reasonable, but can you split the move of
blk_mq_attempt_merge into a separate patch (or just skip it for now)?
This clutters up the diff a lot and makes it much harder to read.
> bool __blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio)
> {
> struct elevator_queue *e = q->elevator;
> + struct blk_mq_ctx *ctx = blk_mq_get_ctx(q);
> + struct blk_mq_hw_ctx *hctx = blk_mq_map_queue(q, ctx->cpu);
> + bool ret = false;
>
> + if (e && e->type->ops.mq.bio_merge) {
> blk_mq_put_ctx(ctx);
> return e->type->ops.mq.bio_merge(hctx, bio);
> + } else if (hctx->flags & BLK_MQ_F_SHOULD_MERGE) {
No need for the relse here given the return. Also both mq-deadline
and cfq don't need the hctx at all and just the queue, so we could even
skip it for that case.
if (e && e->type->ops.mq.bio_merge)
return e->type->ops.mq.bio_merge(q, bio);
ctx = blk_mq_get_ctx(q);
hctx = blk_mq_map_queue(q, ctx->cpu);
if (hctx->flags & BLK_MQ_F_SHOULD_MERGE) {
...
}
(and we only need the hctx for the flags, sigh..)
next prev parent reply other threads:[~2017-05-21 6:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-12 16:20 [PATCH] blk-mq: provide a default .bio_merge Ming Lei
2017-05-21 6:30 ` Christoph Hellwig [this message]
2017-05-22 9:52 ` Ming Lei
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=20170521063059.GA23777@infradead.org \
--to=hch@infradead.org \
--cc=axboe@fb.com \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=osandov@fb.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).