public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next] block: enable per-cpu bio caching for the fs bio set
@ 2022-09-02 16:42 ` Jens Axboe
  2022-09-02 18:48   ` Kanchan Joshi
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2022-09-02 16:42 UTC (permalink / raw)
  To: linux-block@vger.kernel.org; +Cc: Kanchan Joshi

This is useful for polled IO on a file, or for polled IO with the
io_uring passthrough mechanism. If bio allocations are done with
REQ_POLLED for those cases, then initializing the bio set with
BIOSET_PERCPU_CACHE enables the local per-cpu cache which eliminates
allocations (and frees) of bio structs when possible.

Signed-off-by: Jens Axboe <axboe@kernel.dk>

---

diff --git a/block/bio.c b/block/bio.c
index 3d3a2678fea2..d3154d8beed7 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1754,7 +1754,8 @@ static int __init init_bio(void)
 	cpuhp_setup_state_multi(CPUHP_BIO_DEAD, "block/bio:dead", NULL,
 					bio_cpu_dead);
 
-	if (bioset_init(&fs_bio_set, BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS))
+	if (bioset_init(&fs_bio_set, BIO_POOL_SIZE, 0,
+			BIOSET_NEED_BVECS | BIOSET_PERCPU_CACHE))
 		panic("bio: can't allocate bios\n");
 
 	if (bioset_integrity_create(&fs_bio_set, BIO_POOL_SIZE))

-- 
Jens Axboe

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

* Re: [PATCH for-next] block: enable per-cpu bio caching for the fs bio set
  2022-09-02 16:42 ` [PATCH for-next] block: enable per-cpu bio caching for the fs bio set Jens Axboe
@ 2022-09-02 18:48   ` Kanchan Joshi
  0 siblings, 0 replies; 2+ messages in thread
From: Kanchan Joshi @ 2022-09-02 18:48 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

On Fri, Sep 02, 2022 at 10:42:45AM -0600, Jens Axboe wrote:
>This is useful for polled IO on a file, or for polled IO with the
>io_uring passthrough mechanism. If bio allocations are done with
>REQ_POLLED for those cases, then initializing the bio set with
>BIOSET_PERCPU_CACHE enables the local per-cpu cache which eliminates
>allocations (and frees) of bio structs when possible.
>
>Signed-off-by: Jens Axboe <axboe@kernel.dk>

Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2022-09-02 18:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20220902164254epcas5p42cc0e01559b6bce45d9bda336b091c5f@epcas5p4.samsung.com>
2022-09-02 16:42 ` [PATCH for-next] block: enable per-cpu bio caching for the fs bio set Jens Axboe
2022-09-02 18:48   ` Kanchan Joshi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox