From: Jeff Moyer <jmoyer@redhat.com>
To: Shaohua Li <shli@fb.com>
Cc: <linux-kernel@vger.kernel.org>, <axboe@fb.com>, <hch@lst.de>,
<neilb@suse.de>
Subject: Re: [PATCH 5/5] blk-mq: make plug work for mutiple disks and queues
Date: Fri, 01 May 2015 16:55:39 -0400 [thread overview]
Message-ID: <x49618cyq44.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <9cb12b99feb2886a21084bf3f93fab773c93c465.1430414610.git.shli@fb.com> (Shaohua Li's message of "Thu, 30 Apr 2015 10:45:18 -0700")
Shaohua Li <shli@fb.com> writes:
> Last patch makes plug work for multiple queue case. However it only
> works for single disk case, because it assumes only one request in the
> plug list. If a task is accessing multiple disks, eg MD/DM, the
> assumption is wrong. Let blk_attempt_plug_merge() record request from
> the same queue.
I understand the desire to be performant, and that's why you
piggy-backed the same_queue_rq onto this function, but it sure looks
hackish. I'd almost rather walk the list a second time instead of add
warts like this. To be perfectly clear, this is what I really don't
like about it: we're relying on the nuance that we will only add a
single request per queue to the plug_list in the mq case. When you
start to look at what happens for the sq case, it doesn't make much
sense at all, as you'll just return the first entry in the list (last
one visited walking the list backwards) that has the same request queue.
That's fine if this code were mq specific, but it isn't. It will just
lead to confusion for others reviewing the code, and may trip up anyone
modifying the mq plugging code.
I'll leave it up to Jens to decide if this is fit for inclusion. The
patch /functionally/ looks fine to me.
> Cc: Jens Axboe <axboe@fb.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Shaohua Li <shli@fb.com>
> ---
> block/blk-core.c | 10 +++++++---
> block/blk-mq.c | 11 ++++++-----
> block/blk.h | 3 ++-
> 3 files changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index d51ed61..a5e1574 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -1521,7 +1521,8 @@ bool bio_attempt_front_merge(struct request_queue *q, struct request *req,
> * Caller must ensure !blk_queue_nomerges(q) beforehand.
> */
> bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio,
> - unsigned int *request_count)
> + unsigned int *request_count,
> + struct request **same_queue_rq)
> {
> struct blk_plug *plug;
> struct request *rq;
> @@ -1541,8 +1542,10 @@ bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio,
> list_for_each_entry_reverse(rq, plug_list, queuelist) {
> int el_ret;
>
> - if (rq->q == q)
> + if (rq->q == q) {
> (*request_count)++;
> + *same_queue_rq = rq;
> + }
Out of the 3 callers of blk_attempt_plug_merge, only one will use the
result, yet all of them have to provide the argument. How about just
handling NULL in there?
Cheers,
Jeff
next prev parent reply other threads:[~2015-05-01 20:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-30 17:45 [PATCH 0/5] blk plug fixes Shaohua Li
2015-04-30 17:45 ` [PATCH 1/5] blk: clean up plug Shaohua Li
2015-05-01 17:11 ` Christoph Hellwig
2015-04-30 17:45 ` [PATCH 2/5] sched: always use blk_schedule_flush_plug in io_schedule_out Shaohua Li
2015-05-01 17:14 ` Christoph Hellwig
2015-05-01 18:05 ` Shaohua Li
2015-05-01 17:42 ` Jeff Moyer
2015-05-01 18:07 ` Jeff Moyer
2015-05-01 18:28 ` Shaohua Li
2015-05-01 19:37 ` Jeff Moyer
2015-04-30 17:45 ` [PATCH 3/5] blk-mq: fix plugging in blk_sq_make_request Shaohua Li
2015-05-01 17:16 ` Christoph Hellwig
2015-05-01 17:47 ` Jeff Moyer
2015-04-30 17:45 ` [PATCH 4/5] blk-mq: do limited block plug for multiple queue case Shaohua Li
2015-05-01 20:16 ` Jeff Moyer
2015-05-04 19:40 ` Shaohua Li
2015-05-04 19:46 ` Jens Axboe
2015-05-04 20:33 ` Shaohua Li
2015-05-04 20:35 ` Jens Axboe
2015-04-30 17:45 ` [PATCH 5/5] blk-mq: make plug work for mutiple disks and queues Shaohua Li
2015-05-01 20:55 ` Jeff Moyer [this message]
2015-05-04 19:44 ` Shaohua Li
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=x49618cyq44.fsf@segfault.boston.devel.redhat.com \
--to=jmoyer@redhat.com \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
--cc=shli@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
all inboxes | Powered by JetHome®