stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: check more requests for multiple_queues in blk_attempt_plug_merge
@ 2022-03-09  6:42 Song Liu
  2022-03-10  6:48 ` Christoph Hellwig
  2022-03-10 22:15 ` Jens Axboe
  0 siblings, 2 replies; 24+ messages in thread
From: Song Liu @ 2022-03-09  6:42 UTC (permalink / raw)
  To: linux-block, linux-raid
  Cc: axboe, Song Liu, stable, Larkin Lowrey, Wilson Jonathan, Roger Heflin

RAID arrays check/repair operations benefit a lot from merging requests.
If we only check the previous entry for merge attempt, many merge will be
missed. As a result, significant regression is observed for RAID check
and repair.

Fix this by checking more than just the previous entry when
plug->multiple_queues == true.

This improves the check/repair speed of a 20-HDD raid6 from 19 MB/s to
103 MB/s.

Fixes: d38a9c04c0d5 ("block: only check previous entry for plug merge attempt")
Cc: stable@vger.kernel.org # v5.16
Reported-by: Larkin Lowrey <llowrey@nuclearwinter.com>
Reported-by: Wilson Jonathan <i400sjon@gmail.com>
Reported-by: Roger Heflin <rogerheflin@gmail.com>
Signed-off-by: Song Liu <song@kernel.org>
---
 block/blk-merge.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 4de34a332c9f..57e2075fb2f4 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -1089,12 +1089,14 @@ bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio,
 	if (!plug || rq_list_empty(plug->mq_list))
 		return false;
 
-	/* check the previously added entry for a quick merge attempt */
-	rq = rq_list_peek(&plug->mq_list);
-	if (rq->q == q) {
-		if (blk_attempt_bio_merge(q, rq, bio, nr_segs, false) ==
-				BIO_MERGE_OK)
-			return true;
+	rq_list_for_each(&plug->mq_list, rq) {
+		if (rq->q == q) {
+			if (blk_attempt_bio_merge(q, rq, bio, nr_segs, false) ==
+			    BIO_MERGE_OK)
+				return true;
+		}
+		if (!plug->multiple_queues)
+			break;
 	}
 	return false;
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2022-03-11 22:43 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09  6:42 [PATCH] block: check more requests for multiple_queues in blk_attempt_plug_merge Song Liu
2022-03-10  6:48 ` Christoph Hellwig
2022-03-10  7:23   ` Song Liu
2022-03-10 22:10     ` Song Liu
2022-03-10 22:12       ` Song Liu
2022-03-10 22:15 ` Jens Axboe
2022-03-10 22:37   ` Song Liu
2022-03-10 23:02     ` Jens Axboe
2022-03-10 23:33       ` Song Liu
2022-03-11  0:07         ` Jens Axboe
2022-03-11  0:31           ` Song Liu
2022-03-11  0:36             ` Jens Axboe
2022-03-11  0:38               ` Jens Axboe
2022-03-11  1:14               ` Ming Lei
2022-03-11  1:21                 ` Jens Axboe
2022-03-11  1:32                   ` Ming Lei
2022-03-11  1:35                     ` Jens Axboe
2022-03-11  8:09                       ` Wols Lists
2022-03-11 14:16           ` Jens Axboe
2022-03-11 16:59             ` Song Liu
2022-03-11 21:41               ` Paul Menzel
2022-03-11 22:40                 ` Song Liu
2022-03-11 11:30     ` Wilson Jonathan
2022-03-11 15:58       ` Wols Lists

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).