[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220405070355.072987835@linuxfoundation.org>
Date: Tue, 5 Apr 2022 09:15:43 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Song Liu <songliubraving@...com>,
Jens Axboe <axboe@...nel.dk>, Song Liu <song@...nel.org>
Subject: [PATCH 5.16 0030/1017] block: ensure plug merging checks the correct queue at least once
From: Jens Axboe <axboe@...nel.dk>
commit 5b2050718d095cd3242d1f42aaaea3a2fec8e6f0 upstream.
Song reports that a RAID rebuild workload runs much slower recently,
and it is seeing a lot less merging than it did previously. The reason
is that a previous commit reduced the amount of work we do for plug
merging. RAID rebuild interleaves requests between disks, so a last-entry
check in plug merging always misses a merge opportunity since we always
find a different disk than what we are looking for.
Modify the logic such that it's still a one-hit cache, but ensure that
we check enough to find the right target before giving up.
Fixes: d38a9c04c0d5 ("block: only check previous entry for plug merge attempt")
Reported-and-tested-by: Song Liu <song@...nel.org>
Reviewed-by: Song Liu <songliubraving@...com>
Signed-off-by: Jens Axboe <axboe@...nel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
block/blk-merge.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -1093,18 +1093,21 @@ bool blk_attempt_plug_merge(struct reque
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) {
+ rq_list_for_each(&plug->mq_list, rq) {
+ if (rq->q == q) {
+ *same_queue_rq = true;
+ if (blk_attempt_bio_merge(q, rq, bio, nr_segs, false) ==
+ BIO_MERGE_OK)
+ return true;
+ break;
+ }
+
/*
- * Only blk-mq multiple hardware queues case checks the rq in
- * the same queue, there should be only one such rq in a queue
+ * Only keep iterating plug list for merges if we have multiple
+ * queues
*/
- *same_queue_rq = true;
-
- if (blk_attempt_bio_merge(q, rq, bio, nr_segs, false) ==
- BIO_MERGE_OK)
- return true;
+ if (!plug->multiple_queues)
+ break;
}
return false;
}
Powered by blists - more mailing lists