Skip to content

Commit 9a14014

Browse files
liu-song-6gregkh
authored andcommitted
blk-mq: allow 4x BLK_MAX_REQUEST_COUNT at blk_plug for multiple_queues
[ Upstream commit 7f2a6a6 ] Limiting number of request to BLK_MAX_REQUEST_COUNT at blk_plug hurts performance for large md arrays. [1] shows resync speed of md array drops for md array with more than 16 HDDs. Fix this by allowing more request at plug queue. The multiple_queue flag is used to only apply higher limit to multiple queue cases. [1] https://lore.kernel.org/linux-raid/CAFDAVznS71BXW8Jxv6k9dXc2iR3ysX3iZRBww_rzA8WifBFxGg@mail.gmail.com/ Tested-by: Marcin Wanat <marcin.wanat@gmail.com> Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 23dfb95 commit 9a14014

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎block/blk-mq.c‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,18 @@ static void blk_add_rq_to_plug(struct blk_plug *plug, struct request *rq)
21092109
}
21102110
}
21112111

2112+
/*
2113+
* Allow 4x BLK_MAX_REQUEST_COUNT requests on plug queue for multiple
2114+
* queues. This is important for md arrays to benefit from merging
2115+
* requests.
2116+
*/
2117+
static inline unsigned short blk_plug_max_rq_count(struct blk_plug *plug)
2118+
{
2119+
if (plug->multiple_queues)
2120+
return BLK_MAX_REQUEST_COUNT * 4;
2121+
return BLK_MAX_REQUEST_COUNT;
2122+
}
2123+
21122124
/**
21132125
* blk_mq_submit_bio - Create and send a request to block device.
21142126
* @bio: Bio pointer.
@@ -2202,7 +2214,7 @@ blk_qc_t blk_mq_submit_bio(struct bio *bio)
22022214
else
22032215
last = list_entry_rq(plug->mq_list.prev);
22042216

2205-
if (request_count >= BLK_MAX_REQUEST_COUNT || (last &&
2217+
if (request_count >= blk_plug_max_rq_count(plug) || (last &&
22062218
blk_rq_bytes(last) >= BLK_PLUG_FLUSH_SIZE)) {
22072219
blk_flush_plug_list(plug, false);
22082220
trace_block_plug(q);

0 commit comments

Comments
 (0)