Skip to content

Commit

Permalink
blk-mq: allow 4x BLK_MAX_REQUEST_COUNT at blk_plug for multiple_queues
Browse files Browse the repository at this point in the history
[ 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>
  • Loading branch information
liu-song-6 authored and gregkh committed Sep 26, 2021
1 parent 23dfb95 commit 9a14014
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion block/blk-mq.c
Expand Up @@ -2109,6 +2109,18 @@ static void blk_add_rq_to_plug(struct blk_plug *plug, struct request *rq)
}
}

/*
* Allow 4x BLK_MAX_REQUEST_COUNT requests on plug queue for multiple
* queues. This is important for md arrays to benefit from merging
* requests.
*/
static inline unsigned short blk_plug_max_rq_count(struct blk_plug *plug)
{
if (plug->multiple_queues)
return BLK_MAX_REQUEST_COUNT * 4;
return BLK_MAX_REQUEST_COUNT;
}

/**
* blk_mq_submit_bio - Create and send a request to block device.
* @bio: Bio pointer.
Expand Down Expand Up @@ -2202,7 +2214,7 @@ blk_qc_t blk_mq_submit_bio(struct bio *bio)
else
last = list_entry_rq(plug->mq_list.prev);

if (request_count >= BLK_MAX_REQUEST_COUNT || (last &&
if (request_count >= blk_plug_max_rq_count(plug) || (last &&
blk_rq_bytes(last) >= BLK_PLUG_FLUSH_SIZE)) {
blk_flush_plug_list(plug, false);
trace_block_plug(q);
Expand Down

0 comments on commit 9a14014

Please sign in to comment.