diff mbox series

[for-next] block: enable per-cpu bio caching for the fs bio set

Message ID f2863702-e54c-cd74-efcf-8cb238be1a7c@kernel.dk (mailing list archive)
State New, archived
Headers show
Series [for-next] block: enable per-cpu bio caching for the fs bio set | expand

Commit Message

Jens Axboe Sept. 2, 2022, 4:42 p.m. UTC
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>

---

Comments

Kanchan Joshi Sept. 2, 2022, 6:48 p.m. UTC | #1
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>
diff mbox series

Patch

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))