All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Two blk_mq_submit_bio() patches
@ 2024-12-18 21:22 Bart Van Assche
  2024-12-18 21:22 ` [PATCH v3 1/2] block: Reorder the request allocation code in blk_mq_submit_bio() Bart Van Assche
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Bart Van Assche @ 2024-12-18 21:22 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Damien Le Moal, Bart Van Assche

Hi Jens,

This patch series includes two cleanup patches for blk_mq_submit_bio(). No
functionality has been changed.

Please consider this patch series for the next merge window.

Thanks,

Bart.

Changes compared to v2 of this patch series:
 - Changed the title of the first patch.
 - Added unlikely() in the second patch.
 - Dropped the patch that was added as the third patch.

Changes compared to v1 of this patch series:
 - Addressed Christoph's comments on patch 2/3.
 - Added patch 3/3 to this series.

Bart Van Assche (2):
  block: Reorder the request allocation code in blk_mq_submit_bio()
  blk-mq: Move more error handling into blk_mq_submit_bio()

 block/blk-mq.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)


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

* [PATCH v3 1/2] block: Reorder the request allocation code in blk_mq_submit_bio()
  2024-12-18 21:22 [PATCH v3 0/2] Two blk_mq_submit_bio() patches Bart Van Assche
@ 2024-12-18 21:22 ` Bart Van Assche
  2024-12-19  5:33   ` Christoph Hellwig
  2025-01-14  0:43   ` Chaitanya Kulkarni
  2024-12-18 21:22 ` [PATCH v3 2/2] blk-mq: Move more error handling into blk_mq_submit_bio() Bart Van Assche
  2025-01-14 17:13 ` [PATCH v3 0/2] Two blk_mq_submit_bio() patches Jens Axboe
  2 siblings, 2 replies; 8+ messages in thread
From: Bart Van Assche @ 2024-12-18 21:22 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Damien Le Moal, Bart Van Assche

Help the CPU branch predictor in case of a cache hit by handling the cache
hit scenario first.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 block/blk-mq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 7ee21346a41e..8d2aab4d9ba9 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3102,12 +3102,12 @@ void blk_mq_submit_bio(struct bio *bio)
 		goto queue_exit;
 
 new_request:
-	if (!rq) {
+	if (rq) {
+		blk_mq_use_cached_rq(rq, plug, bio);
+	} else {
 		rq = blk_mq_get_new_requests(q, plug, bio, nr_segs);
 		if (unlikely(!rq))
 			goto queue_exit;
-	} else {
-		blk_mq_use_cached_rq(rq, plug, bio);
 	}
 
 	trace_block_getrq(bio);

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

* [PATCH v3 2/2] blk-mq: Move more error handling into blk_mq_submit_bio()
  2024-12-18 21:22 [PATCH v3 0/2] Two blk_mq_submit_bio() patches Bart Van Assche
  2024-12-18 21:22 ` [PATCH v3 1/2] block: Reorder the request allocation code in blk_mq_submit_bio() Bart Van Assche
@ 2024-12-18 21:22 ` Bart Van Assche
  2024-12-19  5:34   ` Christoph Hellwig
  2025-01-14  0:46   ` Chaitanya Kulkarni
  2025-01-14 17:13 ` [PATCH v3 0/2] Two blk_mq_submit_bio() patches Jens Axboe
  2 siblings, 2 replies; 8+ messages in thread
From: Bart Van Assche @ 2024-12-18 21:22 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Damien Le Moal, Bart Van Assche

The error handling code in blk_mq_get_new_requests() cannot be understood
without knowing that this function is only called by blk_mq_submit_bio().
Hence move the code for handling blk_mq_get_new_requests() failures into
blk_mq_submit_bio().

Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 block/blk-mq.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 8d2aab4d9ba9..a83ec9368df6 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2968,12 +2968,9 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
 	}
 
 	rq = __blk_mq_alloc_requests(&data);
-	if (rq)
-		return rq;
-	rq_qos_cleanup(q, bio);
-	if (bio->bi_opf & REQ_NOWAIT)
-		bio_wouldblock_error(bio);
-	return NULL;
+	if (unlikely(!rq))
+		rq_qos_cleanup(q, bio);
+	return rq;
 }
 
 /*
@@ -3106,8 +3103,11 @@ void blk_mq_submit_bio(struct bio *bio)
 		blk_mq_use_cached_rq(rq, plug, bio);
 	} else {
 		rq = blk_mq_get_new_requests(q, plug, bio, nr_segs);
-		if (unlikely(!rq))
+		if (unlikely(!rq)) {
+			if (bio->bi_opf & REQ_NOWAIT)
+				bio_wouldblock_error(bio);
 			goto queue_exit;
+		}
 	}
 
 	trace_block_getrq(bio);

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

* Re: [PATCH v3 1/2] block: Reorder the request allocation code in blk_mq_submit_bio()
  2024-12-18 21:22 ` [PATCH v3 1/2] block: Reorder the request allocation code in blk_mq_submit_bio() Bart Van Assche
@ 2024-12-19  5:33   ` Christoph Hellwig
  2025-01-14  0:43   ` Chaitanya Kulkarni
  1 sibling, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2024-12-19  5:33 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Damien Le Moal

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH v3 2/2] blk-mq: Move more error handling into blk_mq_submit_bio()
  2024-12-18 21:22 ` [PATCH v3 2/2] blk-mq: Move more error handling into blk_mq_submit_bio() Bart Van Assche
@ 2024-12-19  5:34   ` Christoph Hellwig
  2025-01-14  0:46   ` Chaitanya Kulkarni
  1 sibling, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2024-12-19  5:34 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Damien Le Moal

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


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

* Re: [PATCH v3 1/2] block: Reorder the request allocation code in blk_mq_submit_bio()
  2024-12-18 21:22 ` [PATCH v3 1/2] block: Reorder the request allocation code in blk_mq_submit_bio() Bart Van Assche
  2024-12-19  5:33   ` Christoph Hellwig
@ 2025-01-14  0:43   ` Chaitanya Kulkarni
  1 sibling, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2025-01-14  0:43 UTC (permalink / raw)
  To: Bart Van Assche, Jens Axboe
  Cc: linux-block@vger.kernel.org, Christoph Hellwig, Damien Le Moal

On 12/18/24 13:22, Bart Van Assche wrote:
> Help the CPU branch predictor in case of a cache hit by handling the cache
> hit scenario first.
>
> Reviewed-by: Damien Le Moal<dlemoal@kernel.org>
> Cc: Christoph Hellwig<hch@lst.de>
> Signed-off-by: Bart Van Assche<bvanassche@acm.org>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



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

* Re: [PATCH v3 2/2] blk-mq: Move more error handling into blk_mq_submit_bio()
  2024-12-18 21:22 ` [PATCH v3 2/2] blk-mq: Move more error handling into blk_mq_submit_bio() Bart Van Assche
  2024-12-19  5:34   ` Christoph Hellwig
@ 2025-01-14  0:46   ` Chaitanya Kulkarni
  1 sibling, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2025-01-14  0:46 UTC (permalink / raw)
  To: Bart Van Assche, Jens Axboe
  Cc: linux-block@vger.kernel.org, Christoph Hellwig, Damien Le Moal

On 12/18/24 13:22, Bart Van Assche wrote:
> The error handling code in blk_mq_get_new_requests() cannot be understood
> without knowing that this function is only called by blk_mq_submit_bio().
> Hence move the code for handling blk_mq_get_new_requests() failures into
> blk_mq_submit_bio().
>
> Cc: Damien Le Moal<dlemoal@kernel.org>
> Cc: Christoph Hellwig<hch@lst.de>
> Signed-off-by: Bart Van Assche<bvanassche@acm.org>
> ---


Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



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

* Re: [PATCH v3 0/2] Two blk_mq_submit_bio() patches
  2024-12-18 21:22 [PATCH v3 0/2] Two blk_mq_submit_bio() patches Bart Van Assche
  2024-12-18 21:22 ` [PATCH v3 1/2] block: Reorder the request allocation code in blk_mq_submit_bio() Bart Van Assche
  2024-12-18 21:22 ` [PATCH v3 2/2] blk-mq: Move more error handling into blk_mq_submit_bio() Bart Van Assche
@ 2025-01-14 17:13 ` Jens Axboe
  2 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2025-01-14 17:13 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-block, Christoph Hellwig, Damien Le Moal


On Wed, 18 Dec 2024 13:22:44 -0800, Bart Van Assche wrote:
> This patch series includes two cleanup patches for blk_mq_submit_bio(). No
> functionality has been changed.
> 
> Please consider this patch series for the next merge window.
> 
> Thanks,
> 
> [...]

Applied, thanks!

[1/2] block: Reorder the request allocation code in blk_mq_submit_bio()
      commit: 44e41381591dc5b4ea67a9f170b4ec85c817586e
[2/2] blk-mq: Move more error handling into blk_mq_submit_bio()
      commit: 659381520a3b13403c3051516317adc02e48259b

Best regards,
-- 
Jens Axboe




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

end of thread, other threads:[~2025-01-14 17:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18 21:22 [PATCH v3 0/2] Two blk_mq_submit_bio() patches Bart Van Assche
2024-12-18 21:22 ` [PATCH v3 1/2] block: Reorder the request allocation code in blk_mq_submit_bio() Bart Van Assche
2024-12-19  5:33   ` Christoph Hellwig
2025-01-14  0:43   ` Chaitanya Kulkarni
2024-12-18 21:22 ` [PATCH v3 2/2] blk-mq: Move more error handling into blk_mq_submit_bio() Bart Van Assche
2024-12-19  5:34   ` Christoph Hellwig
2025-01-14  0:46   ` Chaitanya Kulkarni
2025-01-14 17:13 ` [PATCH v3 0/2] Two blk_mq_submit_bio() patches Jens Axboe

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.