diff mbox

[V2,2/2] blk-mq: immediately dispatch big size request

Message ID 6297c9a39cf21c94c65d5a9b3a19e54ba5b8b573.1478217671.git.shli@fb.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shaohua Li Nov. 4, 2016, 12:03 a.m. UTC
This is corresponding part for blk-mq. Disk with multiple hardware
queues doesn't need this as we only hold 1 request at most.

Signed-off-by: Shaohua Li <shli@fb.com>
---
 block/blk-mq.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig Nov. 4, 2016, 12:09 a.m. UTC | #1
On Thu, Nov 03, 2016 at 05:03:54PM -0700, Shaohua Li wrote:
> This is corresponding part for blk-mq. Disk with multiple hardware
> queues doesn't need this as we only hold 1 request at most.

Any reason you only do this for the SQ and not the MQ case?
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shaohua Li Nov. 4, 2016, 12:13 a.m. UTC | #2
On Thu, Nov 03, 2016 at 05:09:54PM -0700, Christoph Hellwig wrote:
> On Thu, Nov 03, 2016 at 05:03:54PM -0700, Shaohua Li wrote:
> > This is corresponding part for blk-mq. Disk with multiple hardware
> > queues doesn't need this as we only hold 1 request at most.
> 
> Any reason you only do this for the SQ and not the MQ case?

Right above:
Disk with multiple hardware queues doesn't need this as we only hold 1
request at most.

Thanks,
Shaohua
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jens Axboe Nov. 4, 2016, 4 a.m. UTC | #3
On 11/03/2016 06:13 PM, Shaohua Li wrote:
> On Thu, Nov 03, 2016 at 05:09:54PM -0700, Christoph Hellwig wrote:
>> On Thu, Nov 03, 2016 at 05:03:54PM -0700, Shaohua Li wrote:
>>> This is corresponding part for blk-mq. Disk with multiple hardware
>>> queues doesn't need this as we only hold 1 request at most.
>>
>> Any reason you only do this for the SQ and not the MQ case?
>
> Right above:
> Disk with multiple hardware queues doesn't need this as we only hold 1
> request at most.

I've applied 1-2 for 4.10, but we probably should look into unifying
those parts of sq and mq in general. For instance, it doesn't seem to
make a lot of sense why we'd depth limit sq and not mq.
Christoph Hellwig Nov. 4, 2016, 2:46 p.m. UTC | #4
On Thu, Nov 03, 2016 at 10:00:58PM -0600, Jens Axboe wrote:
> I've applied 1-2 for 4.10, but we probably should look into unifying
> those parts of sq and mq in general. For instance, it doesn't seem to
> make a lot of sense why we'd depth limit sq and not mq.

I've spent some time looking the the make_request_fn and to be honest
I think that whole sq vs mq split is pointless.  They are about 70-80%
the same anyway, and I think everyone would be served much better
by merging them.
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jens Axboe Nov. 4, 2016, 3:29 p.m. UTC | #5
On 11/04/2016 08:46 AM, Christoph Hellwig wrote:
> On Thu, Nov 03, 2016 at 10:00:58PM -0600, Jens Axboe wrote:
>> I've applied 1-2 for 4.10, but we probably should look into unifying
>> those parts of sq and mq in general. For instance, it doesn't seem to
>> make a lot of sense why we'd depth limit sq and not mq.
>
> I've spent some time looking the the make_request_fn and to be honest
> I think that whole sq vs mq split is pointless.  They are about 70-80%
> the same anyway, and I think everyone would be served much better
> by merging them.

Yeah, that was my point, at least if we can do it without having too
many extra conditionals. Or at least split some of it into helpers.
diff mbox

Patch

diff --git a/block/blk-mq.c b/block/blk-mq.c
index f3d27a6..a72538a 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1401,13 +1401,18 @@  static blk_qc_t blk_sq_make_request(struct request_queue *q, struct bio *bio)
 	 */
 	plug = current->plug;
 	if (plug) {
+		struct request *last = NULL;
+
 		blk_mq_bio_to_request(rq, bio);
 		if (!request_count)
 			trace_block_plug(q);
+		else
+			last = list_entry_rq(plug->mq_list.prev);
 
 		blk_mq_put_ctx(data.ctx);
 
-		if (request_count >= BLK_MAX_REQUEST_COUNT) {
+		if (request_count >= BLK_MAX_REQUEST_COUNT || (last &&
+		    blk_rq_bytes(last) >= BLK_PLUG_FLUSH_SIZE)) {
 			blk_flush_plug_list(plug, false);
 			trace_block_plug(q);
 		}