All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: fix bio-cache for passthru IO
       [not found] <CGME20230523112014epcas5p267f30562f3f2e3c6d58fbb76c0084e5b@epcas5p2.samsung.com>
@ 2023-05-23 11:17 ` Anuj Gupta
  2023-05-23 11:35   ` Christoph Hellwig
  2023-05-23 17:13   ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Anuj Gupta @ 2023-05-23 11:17 UTC (permalink / raw)
  To: axboe, hch
  Cc: linux-block, gost.dev, anuj1072538, joshiiitr, Anuj Gupta, stable,
	Kanchan Joshi

commit <8af870aa5b847> ("block: enable bio caching use for passthru IO")
introduced bio-cache for passthru IO. In case when nr_vecs are greater
than BIO_INLINE_VECS, bio and bvecs are allocated from mempool (instead
of percpu cache) and REQ_ALLOC_CACHE is cleared. This causes the side
effect of not freeing bio/bvecs into mempool on completion.

This patch lets the passthru IO fallback to allocation using bio_kmalloc
when nr_vecs are greater than BIO_INLINE_VECS. The corresponding bio
is freed during call to blk_mq_map_bio_put during completion.

Cc: stable@vger.kernel.org # 6.1
fixes <8af870aa5b847> ("block: enable bio caching use for passthru IO")

Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
---
 block/blk-map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-map.c b/block/blk-map.c
index 9137d16cecdc..9c03e641d32c 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -247,7 +247,7 @@ static struct bio *blk_rq_map_bio_alloc(struct request *rq,
 {
 	struct bio *bio;
 
-	if (rq->cmd_flags & REQ_ALLOC_CACHE) {
+	if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) {
 		bio = bio_alloc_bioset(NULL, nr_vecs, rq->cmd_flags, gfp_mask,
 					&fs_bio_set);
 		if (!bio)
-- 
2.34.1


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

* Re: [PATCH] block: fix bio-cache for passthru IO
  2023-05-23 11:17 ` [PATCH] block: fix bio-cache for passthru IO Anuj Gupta
@ 2023-05-23 11:35   ` Christoph Hellwig
  2023-05-23 17:13   ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2023-05-23 11:35 UTC (permalink / raw)
  To: Anuj Gupta
  Cc: axboe, hch, linux-block, gost.dev, anuj1072538, joshiiitr, stable,
	Kanchan Joshi

On Tue, May 23, 2023 at 04:47:09PM +0530, Anuj Gupta wrote:
> +	if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) {

The inner braces are superflous.

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

* Re: [PATCH] block: fix bio-cache for passthru IO
  2023-05-23 11:17 ` [PATCH] block: fix bio-cache for passthru IO Anuj Gupta
  2023-05-23 11:35   ` Christoph Hellwig
@ 2023-05-23 17:13   ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2023-05-23 17:13 UTC (permalink / raw)
  To: hch, Anuj Gupta
  Cc: linux-block, gost.dev, anuj1072538, joshiiitr, stable,
	Kanchan Joshi


On Tue, 23 May 2023 16:47:09 +0530, Anuj Gupta wrote:
> commit <8af870aa5b847> ("block: enable bio caching use for passthru IO")
> introduced bio-cache for passthru IO. In case when nr_vecs are greater
> than BIO_INLINE_VECS, bio and bvecs are allocated from mempool (instead
> of percpu cache) and REQ_ALLOC_CACHE is cleared. This causes the side
> effect of not freeing bio/bvecs into mempool on completion.
> 
> This patch lets the passthru IO fallback to allocation using bio_kmalloc
> when nr_vecs are greater than BIO_INLINE_VECS. The corresponding bio
> is freed during call to blk_mq_map_bio_put during completion.
> 
> [...]

Applied, thanks!

[1/1] block: fix bio-cache for passthru IO
      (no commit info)

Best regards,
-- 
Jens Axboe




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

end of thread, other threads:[~2023-05-23 17:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20230523112014epcas5p267f30562f3f2e3c6d58fbb76c0084e5b@epcas5p2.samsung.com>
2023-05-23 11:17 ` [PATCH] block: fix bio-cache for passthru IO Anuj Gupta
2023-05-23 11:35   ` Christoph Hellwig
2023-05-23 17:13   ` 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.