From: Jan Kara <jack@suse.cz> To: Jens Axboe <axboe@kernel.dk> Cc: <linux-block@vger.kernel.org>, Khazhy Kumykov <khazhy@google.com>, Paolo Valente <paolo.valente@linaro.org>, Jan Kara <jack@suse.cz> Subject: [PATCH 1/2] block: Do not merge recursively in elv_attempt_insert_merge() Date: Fri, 21 May 2021 00:33:52 +0200 [thread overview] Message-ID: <20210520223353.11561-2-jack@suse.cz> (raw) In-Reply-To: <20210520223353.11561-1-jack@suse.cz> Most of the merging happens at bio level. There should not be much merging happening at request level anymore. Furthermore if we backmerged a request to the previous one, the chances to be able to merge the result to even previous request are slim - that could succeed only if requests were inserted in 2 1 3 order. Merging more requests in elv_attempt_insert_merge() will be difficult to handle when we want to pass requests to free back to the caller of blk_mq_sched_try_insert_merge(). So just remove the possibility of merging multiple requests in elv_attempt_insert_merge(). Signed-off-by: Jan Kara <jack@suse.cz> --- block/elevator.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/block/elevator.c b/block/elevator.c index 440699c28119..098f4bd226f5 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -350,12 +350,11 @@ enum elv_merge elv_merge(struct request_queue *q, struct request **req, * we can append 'rq' to an existing request, so we can throw 'rq' away * afterwards. * - * Returns true if we merged, false otherwise + * Returns true if we merged, false otherwise. */ bool elv_attempt_insert_merge(struct request_queue *q, struct request *rq) { struct request *__rq; - bool ret; if (blk_queue_nomerges(q)) return false; @@ -369,21 +368,13 @@ bool elv_attempt_insert_merge(struct request_queue *q, struct request *rq) if (blk_queue_noxmerges(q)) return false; - ret = false; /* * See if our hash lookup can find a potential backmerge. */ - while (1) { - __rq = elv_rqhash_find(q, blk_rq_pos(rq)); - if (!__rq || !blk_attempt_req_merge(q, __rq, rq)) - break; - - /* The merged request could be merged with others, try again */ - ret = true; - rq = __rq; - } - - return ret; + __rq = elv_rqhash_find(q, blk_rq_pos(rq)); + if (!__rq || !blk_attempt_req_merge(q, __rq, rq)) + return false; + return true; } void elv_merged_request(struct request_queue *q, struct request *rq, -- 2.26.2
next prev parent reply other threads:[~2021-05-20 22:34 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-20 22:33 [PATCH 0/2] block: Fix deadlock when merging requests with BFQ Jan Kara 2021-05-20 22:33 ` Jan Kara [this message] 2021-05-21 0:42 ` [PATCH 1/2] block: Do not merge recursively in elv_attempt_insert_merge() Ming Lei 2021-05-21 11:53 ` Jan Kara 2021-05-21 13:12 ` Ming Lei 2021-05-21 13:44 ` Jan Kara 2021-05-20 22:33 ` [PATCH 2/2] blk: Fix lock inversion between ioc lock and bfqd lock Jan Kara 2021-05-21 0:57 ` Ming Lei 2021-05-21 3:29 ` Khazhy Kumykov 2021-05-21 6:54 ` Ming Lei 2021-05-21 12:05 ` Jan Kara 2021-05-21 13:36 ` Ming Lei 2021-05-21 13:47 ` Jan Kara
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210520223353.11561-2-jack@suse.cz \ --to=jack@suse.cz \ --cc=axboe@kernel.dk \ --cc=khazhy@google.com \ --cc=linux-block@vger.kernel.org \ --cc=paolo.valente@linaro.org \ --subject='Re: [PATCH 1/2] block: Do not merge recursively in elv_attempt_insert_merge()' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.