* [PATCH] block: enable per-cpu bio cache by default
@ 2025-10-11 1:33 Fengnan Chang
2025-10-11 1:36 ` fengnan chang
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Fengnan Chang @ 2025-10-11 1:33 UTC (permalink / raw)
To: axboe, viro, brauner, jack, asml.silence, willy, djwong, hch,
ritesh.list, linux-fsdevel, io-uring, linux-xfs, linux-ext4
Cc: Fengnan Chang
Per cpu bio cache was only used in the io_uring + raw block device,
after commit 12e4e8c7ab59 ("io_uring/rw: enable bio caches for IRQ
rw"), bio_put is safe for task and irq context, bio_alloc_bioset is
safe for task context and no one calls in irq context, so we can enable
per cpu bio cache by default.
Benchmarked with t/io_uring and ext4+nvme:
taskset -c 6 /root/fio/t/io_uring -p0 -d128 -b4096 -s1 -c1 -F1 -B1 -R1
-X1 -n1 -P1 /mnt/testfile
base IOPS is 562K, patch IOPS is 574K. The CPU usage of bio_alloc_bioset
decrease from 1.42% to 1.22%.
The worst case is allocate bio in CPU A but free in CPU B, still use
t/io_uring and ext4+nvme:
base IOPS is 648K, patch IOPS is 647K.
Also use fio test ext4/xfs with libaio/sync/io_uring on null_blk and
nvme, no obvious performance regression.
Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
---
block/bio.c | 26 ++++++++++++--------------
block/blk-map.c | 4 ++++
block/fops.c | 4 ----
include/linux/fs.h | 3 ---
io_uring/rw.c | 1 -
5 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index 3b371a5da159..16b20c10cab7 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -513,20 +513,18 @@ struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs,
if (WARN_ON_ONCE(!mempool_initialized(&bs->bvec_pool) && nr_vecs > 0))
return NULL;
- if (opf & REQ_ALLOC_CACHE) {
- if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
- bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
- gfp_mask, bs);
- if (bio)
- return bio;
- /*
- * No cached bio available, bio returned below marked with
- * REQ_ALLOC_CACHE to particpate in per-cpu alloc cache.
- */
- } else {
- opf &= ~REQ_ALLOC_CACHE;
- }
- }
+ opf |= REQ_ALLOC_CACHE;
+ if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
+ bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
+ gfp_mask, bs);
+ if (bio)
+ return bio;
+ /*
+ * No cached bio available, bio returned below marked with
+ * REQ_ALLOC_CACHE to participate in per-cpu alloc cache.
+ */
+ } else
+ opf &= ~REQ_ALLOC_CACHE;
/*
* submit_bio_noacct() converts recursion to iteration; this means if
diff --git a/block/blk-map.c b/block/blk-map.c
index 23e5d5ebe59e..570a7ca6edd1 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -255,6 +255,10 @@ static struct bio *blk_rq_map_bio_alloc(struct request *rq,
{
struct bio *bio;
+ /*
+ * Even REQ_ALLOC_CACHE is enabled by default, we still need this to
+ * mark bio is allocated by bio_alloc_bioset.
+ */
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);
diff --git a/block/fops.c b/block/fops.c
index ddbc69c0922b..090562a91b4c 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -177,8 +177,6 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
loff_t pos = iocb->ki_pos;
int ret = 0;
- if (iocb->ki_flags & IOCB_ALLOC_CACHE)
- opf |= REQ_ALLOC_CACHE;
bio = bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL,
&blkdev_dio_pool);
dio = container_of(bio, struct blkdev_dio, bio);
@@ -326,8 +324,6 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb,
loff_t pos = iocb->ki_pos;
int ret = 0;
- if (iocb->ki_flags & IOCB_ALLOC_CACHE)
- opf |= REQ_ALLOC_CACHE;
bio = bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL,
&blkdev_dio_pool);
dio = container_of(bio, struct blkdev_dio, bio);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 601d036a6c78..18ec41732186 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -365,8 +365,6 @@ struct readahead_control;
/* iocb->ki_waitq is valid */
#define IOCB_WAITQ (1 << 19)
#define IOCB_NOIO (1 << 20)
-/* can use bio alloc cache */
-#define IOCB_ALLOC_CACHE (1 << 21)
/*
* IOCB_DIO_CALLER_COMP can be set by the iocb owner, to indicate that the
* iocb completion can be passed back to the owner for execution from a safe
@@ -399,7 +397,6 @@ struct readahead_control;
{ IOCB_WRITE, "WRITE" }, \
{ IOCB_WAITQ, "WAITQ" }, \
{ IOCB_NOIO, "NOIO" }, \
- { IOCB_ALLOC_CACHE, "ALLOC_CACHE" }, \
{ IOCB_DIO_CALLER_COMP, "CALLER_COMP" }, \
{ IOCB_AIO_RW, "AIO_RW" }, \
{ IOCB_HAS_METADATA, "AIO_HAS_METADATA" }
diff --git a/io_uring/rw.c b/io_uring/rw.c
index af5a54b5db12..fa7655ab9097 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -856,7 +856,6 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type)
ret = kiocb_set_rw_flags(kiocb, rw->flags, rw_type);
if (unlikely(ret))
return ret;
- kiocb->ki_flags |= IOCB_ALLOC_CACHE;
/*
* If the file is marked O_NONBLOCK, still allow retry for it if it
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] block: enable per-cpu bio cache by default
2025-10-11 1:33 [PATCH] block: enable per-cpu bio cache by default Fengnan Chang
@ 2025-10-11 1:36 ` fengnan chang
2025-10-11 1:43 ` fengnan chang
2025-10-13 3:24 ` Christoph Hellwig
2025-10-13 5:18 ` Ming Lei
2 siblings, 1 reply; 11+ messages in thread
From: fengnan chang @ 2025-10-11 1:36 UTC (permalink / raw)
To: Fengnan Chang
Cc: axboe, viro, brauner, jack, asml.silence, willy, djwong, hch,
ritesh.list, linux-fsdevel, io-uring, linux-xfs, linux-ext4,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 6192 bytes --]
The attachment is result of fio test ext4/xfs with
libaio/sync/io_uring on null_blk and
nvme.
On Sat, Oct 11, 2025 at 9:33 AM Fengnan Chang
<changfengnan@bytedance.com> wrote:
>
> Per cpu bio cache was only used in the io_uring + raw block device,
> after commit 12e4e8c7ab59 ("io_uring/rw: enable bio caches for IRQ
> rw"), bio_put is safe for task and irq context, bio_alloc_bioset is
> safe for task context and no one calls in irq context, so we can enable
> per cpu bio cache by default.
>
> Benchmarked with t/io_uring and ext4+nvme:
> taskset -c 6 /root/fio/t/io_uring -p0 -d128 -b4096 -s1 -c1 -F1 -B1 -R1
> -X1 -n1 -P1 /mnt/testfile
> base IOPS is 562K, patch IOPS is 574K. The CPU usage of bio_alloc_bioset
> decrease from 1.42% to 1.22%.
>
> The worst case is allocate bio in CPU A but free in CPU B, still use
> t/io_uring and ext4+nvme:
> base IOPS is 648K, patch IOPS is 647K.
>
> Also use fio test ext4/xfs with libaio/sync/io_uring on null_blk and
> nvme, no obvious performance regression.
>
> Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
> ---
> block/bio.c | 26 ++++++++++++--------------
> block/blk-map.c | 4 ++++
> block/fops.c | 4 ----
> include/linux/fs.h | 3 ---
> io_uring/rw.c | 1 -
> 5 files changed, 16 insertions(+), 22 deletions(-)
>
> diff --git a/block/bio.c b/block/bio.c
> index 3b371a5da159..16b20c10cab7 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -513,20 +513,18 @@ struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs,
> if (WARN_ON_ONCE(!mempool_initialized(&bs->bvec_pool) && nr_vecs > 0))
> return NULL;
>
> - if (opf & REQ_ALLOC_CACHE) {
> - if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
> - bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
> - gfp_mask, bs);
> - if (bio)
> - return bio;
> - /*
> - * No cached bio available, bio returned below marked with
> - * REQ_ALLOC_CACHE to particpate in per-cpu alloc cache.
> - */
> - } else {
> - opf &= ~REQ_ALLOC_CACHE;
> - }
> - }
> + opf |= REQ_ALLOC_CACHE;
> + if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
> + bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
> + gfp_mask, bs);
> + if (bio)
> + return bio;
> + /*
> + * No cached bio available, bio returned below marked with
> + * REQ_ALLOC_CACHE to participate in per-cpu alloc cache.
> + */
> + } else
> + opf &= ~REQ_ALLOC_CACHE;
>
> /*
> * submit_bio_noacct() converts recursion to iteration; this means if
> diff --git a/block/blk-map.c b/block/blk-map.c
> index 23e5d5ebe59e..570a7ca6edd1 100644
> --- a/block/blk-map.c
> +++ b/block/blk-map.c
> @@ -255,6 +255,10 @@ static struct bio *blk_rq_map_bio_alloc(struct request *rq,
> {
> struct bio *bio;
>
> + /*
> + * Even REQ_ALLOC_CACHE is enabled by default, we still need this to
> + * mark bio is allocated by bio_alloc_bioset.
> + */
> 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);
> diff --git a/block/fops.c b/block/fops.c
> index ddbc69c0922b..090562a91b4c 100644
> --- a/block/fops.c
> +++ b/block/fops.c
> @@ -177,8 +177,6 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
> loff_t pos = iocb->ki_pos;
> int ret = 0;
>
> - if (iocb->ki_flags & IOCB_ALLOC_CACHE)
> - opf |= REQ_ALLOC_CACHE;
> bio = bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL,
> &blkdev_dio_pool);
> dio = container_of(bio, struct blkdev_dio, bio);
> @@ -326,8 +324,6 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb,
> loff_t pos = iocb->ki_pos;
> int ret = 0;
>
> - if (iocb->ki_flags & IOCB_ALLOC_CACHE)
> - opf |= REQ_ALLOC_CACHE;
> bio = bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL,
> &blkdev_dio_pool);
> dio = container_of(bio, struct blkdev_dio, bio);
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 601d036a6c78..18ec41732186 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -365,8 +365,6 @@ struct readahead_control;
> /* iocb->ki_waitq is valid */
> #define IOCB_WAITQ (1 << 19)
> #define IOCB_NOIO (1 << 20)
> -/* can use bio alloc cache */
> -#define IOCB_ALLOC_CACHE (1 << 21)
> /*
> * IOCB_DIO_CALLER_COMP can be set by the iocb owner, to indicate that the
> * iocb completion can be passed back to the owner for execution from a safe
> @@ -399,7 +397,6 @@ struct readahead_control;
> { IOCB_WRITE, "WRITE" }, \
> { IOCB_WAITQ, "WAITQ" }, \
> { IOCB_NOIO, "NOIO" }, \
> - { IOCB_ALLOC_CACHE, "ALLOC_CACHE" }, \
> { IOCB_DIO_CALLER_COMP, "CALLER_COMP" }, \
> { IOCB_AIO_RW, "AIO_RW" }, \
> { IOCB_HAS_METADATA, "AIO_HAS_METADATA" }
> diff --git a/io_uring/rw.c b/io_uring/rw.c
> index af5a54b5db12..fa7655ab9097 100644
> --- a/io_uring/rw.c
> +++ b/io_uring/rw.c
> @@ -856,7 +856,6 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type)
> ret = kiocb_set_rw_flags(kiocb, rw->flags, rw_type);
> if (unlikely(ret))
> return ret;
> - kiocb->ki_flags |= IOCB_ALLOC_CACHE;
>
> /*
> * If the file is marked O_NONBLOCK, still allow retry for it if it
> --
> 2.39.5 (Apple Git-154)
>
>
[-- Attachment #2: nullblk_fs_results.csv --]
[-- Type: text/csv, Size: 13501 bytes --]
engine,medium,fs_type,numjobs,qdepth,pattern,bs,repeat_id,IOPS,IOPS_new,diff
io_uring,null_blk,ext4,1,1,randread,4k,1,441198.8267,444427.4858,0.732%
io_uring,null_blk,ext4,1,1,randread,4k,2,438292.0236,444626.8791,1.445%
io_uring,null_blk,ext4,64,1,randread,4k,1,623393.3404,626214.819,0.453%
io_uring,null_blk,ext4,64,1,randread,4k,2,647703.9099,651817.2122,0.635%
io_uring,null_blk,ext4,1,64,randread,4k,1,437348.1551,447378.1541,2.293%
io_uring,null_blk,ext4,1,64,randread,4k,2,438420.686,439090.597,0.153%
io_uring,null_blk,ext4,64,64,randread,4k,1,613022.2319,627484.3677,2.359%
io_uring,null_blk,ext4,64,64,randread,4k,2,635499.2667,644955.9681,1.488%
sync,null_blk,ext4,1,1,randread,4k,1,454084.1639,468834.9388,3.248%
sync,null_blk,ext4,1,1,randread,4k,2,455824.1725,468547.9151,2.791%
sync,null_blk,ext4,64,1,randread,4k,1,670424.8525,642894.8702,-4.106%
sync,null_blk,ext4,64,1,randread,4k,2,668011.1326,662956.4696,-0.757%
sync,null_blk,ext4,1,64,randread,4k,1,455420.3527,468979.1674,2.977%
sync,null_blk,ext4,1,64,randread,4k,2,454994.9002,468998.3667,3.078%
sync,null_blk,ext4,64,64,randread,4k,1,634728.5514,653207.1931,2.911%
sync,null_blk,ext4,64,64,randread,4k,2,653390.687,664944.6685,1.768%
libaio,null_blk,ext4,1,1,randread,4k,1,392878.9707,396726.4425,0.979%
libaio,null_blk,ext4,1,1,randread,4k,2,394461.5846,386290.057,-2.072%
libaio,null_blk,ext4,64,1,randread,4k,1,662702.9531,626737.4842,-5.427%
libaio,null_blk,ext4,64,1,randread,4k,2,664373.2418,649577.2615,-2.227%
libaio,null_blk,ext4,1,64,randread,4k,1,389144.0619,394488.917,1.373%
libaio,null_blk,ext4,1,64,randread,4k,2,388512.7496,395454.6182,1.787%
libaio,null_blk,ext4,64,64,randread,4k,1,646725.7274,665992.6338,2.979%
libaio,null_blk,ext4,64,64,randread,4k,2,659051.4632,664381.4746,0.809%
io_uring,null_blk,ext4,1,1,randwrite,4k,1,394427.2191,401977.2341,1.914%
io_uring,null_blk,ext4,1,1,randwrite,4k,2,395511.5163,405092.3303,2.422%
io_uring,null_blk,ext4,64,1,randwrite,4k,1,586415.439,595103.7931,1.482%
io_uring,null_blk,ext4,64,1,randwrite,4k,2,599089.297,601064.8957,0.330%
io_uring,null_blk,ext4,1,64,randwrite,4k,1,389689.6437,401716.3095,3.086%
io_uring,null_blk,ext4,1,64,randwrite,4k,2,389294.3235,400062.4313,2.766%
io_uring,null_blk,ext4,64,64,randwrite,4k,1,558149.9567,573073.6642,2.674%
io_uring,null_blk,ext4,64,64,randwrite,4k,2,578677.4774,592423.5384,2.375%
sync,null_blk,ext4,1,1,randwrite,4k,1,404169.1277,419424.8192,3.775%
sync,null_blk,ext4,1,1,randwrite,4k,2,407123.6292,419106.5298,2.943%
sync,null_blk,ext4,64,1,randwrite,4k,1,588728.609,606475.7683,3.014%
sync,null_blk,ext4,64,1,randwrite,4k,2,597677.4882,606913.3362,1.545%
sync,null_blk,ext4,1,64,randwrite,4k,1,404179.7273,418733.2756,3.601%
sync,null_blk,ext4,1,64,randwrite,4k,2,404691.5769,418666.8778,3.453%
sync,null_blk,ext4,64,64,randwrite,4k,1,601734.5755,602147.7568,0.069%
sync,null_blk,ext4,64,64,randwrite,4k,2,599747.9501,602586.8471,0.473%
libaio,null_blk,ext4,1,1,randwrite,4k,1,357191.4936,360791.4736,1.008%
libaio,null_blk,ext4,1,1,randwrite,4k,2,357478.9507,360454.5182,0.832%
libaio,null_blk,ext4,64,1,randwrite,4k,1,601447.5035,603345.7436,0.316%
libaio,null_blk,ext4,64,1,randwrite,4k,2,602304.7898,606106.8631,0.631%
libaio,null_blk,ext4,1,64,randwrite,4k,1,350824.4392,356243.1919,1.545%
libaio,null_blk,ext4,1,64,randwrite,4k,2,350145.0285,354323.4226,1.193%
libaio,null_blk,ext4,64,64,randwrite,4k,1,595570.5953,596466.5844,0.150%
libaio,null_blk,ext4,64,64,randwrite,4k,2,594397.9068,602166.1223,1.307%
io_uring,null_blk,ext4,1,1,read,4k,1,529039.4987,537225.9925,1.547%
io_uring,null_blk,ext4,1,1,read,4k,2,527759.8747,537201.8266,1.789%
io_uring,null_blk,ext4,64,1,read,4k,1,1403079.461,1386281.515,-1.197%
io_uring,null_blk,ext4,64,1,read,4k,2,1410699.553,1380138.619,-2.166%
io_uring,null_blk,ext4,1,64,read,4k,1,529479.1507,535276.3575,1.095%
io_uring,null_blk,ext4,1,64,read,4k,2,527735.4422,538318.3894,2.005%
io_uring,null_blk,ext4,64,64,read,4k,1,1421744.15,1383050.397,-2.722%
io_uring,null_blk,ext4,64,64,read,4k,2,1431458.069,1385506.066,-3.210%
sync,null_blk,ext4,1,1,read,4k,1,585854.0049,609895.2702,4.104%
sync,null_blk,ext4,1,1,read,4k,2,584543.3152,608897.2368,4.166%
sync,null_blk,ext4,64,1,read,4k,1,1424210.093,1401115.659,-1.622%
sync,null_blk,ext4,64,1,read,4k,2,1410422.953,1398356.976,-0.855%
sync,null_blk,ext4,1,64,read,4k,1,588193.8269,609792.1069,3.672%
sync,null_blk,ext4,1,64,read,4k,2,586669.1444,611692.3103,4.265%
sync,null_blk,ext4,64,64,read,4k,1,1438125.158,1422419.305,-1.092%
sync,null_blk,ext4,64,64,read,4k,2,1443236.451,1422347.843,-1.447%
libaio,null_blk,ext4,1,1,read,4k,1,465782.6072,475126.8958,2.006%
libaio,null_blk,ext4,1,1,read,4k,2,467479.4507,474879.304,1.583%
libaio,null_blk,ext4,64,1,read,4k,1,1411494.867,1390203.52,-1.508%
libaio,null_blk,ext4,64,1,read,4k,2,1412681.888,1379708.253,-2.334%
libaio,null_blk,ext4,1,64,read,4k,1,466443.9852,472040.0987,1.200%
libaio,null_blk,ext4,1,64,read,4k,2,465601.2133,472030.5323,1.381%
libaio,null_blk,ext4,64,64,read,4k,1,1387027.098,1373683.321,-0.962%
libaio,null_blk,ext4,64,64,read,4k,2,1386404.82,1366834.311,-1.412%
io_uring,null_blk,ext4,1,1,write,4k,1,444342.1219,457303.7232,2.917%
io_uring,null_blk,ext4,1,1,write,4k,2,445389.5537,455028.1991,2.164%
io_uring,null_blk,ext4,64,1,write,4k,1,903699.2534,886751.3832,-1.875%
io_uring,null_blk,ext4,64,1,write,4k,2,940998.4668,916441.5706,-2.610%
io_uring,null_blk,ext4,1,64,write,4k,1,444266.1578,456392.5202,2.730%
io_uring,null_blk,ext4,1,64,write,4k,2,444253.7249,454811.3063,2.376%
io_uring,null_blk,ext4,64,64,write,4k,1,922628.4581,925767.0155,0.340%
io_uring,null_blk,ext4,64,64,write,4k,2,953284.681,930794.1471,-2.359%
sync,null_blk,ext4,1,1,write,4k,1,488170.861,497273.6242,1.865%
sync,null_blk,ext4,1,1,write,4k,2,488489.8503,496765.8745,1.694%
sync,null_blk,ext4,64,1,write,4k,1,876332.6445,907755.0497,3.586%
sync,null_blk,ext4,64,1,write,4k,2,901786.1809,892212.9191,-1.062%
sync,null_blk,ext4,1,64,write,4k,1,487997.3001,496561.9479,1.755%
sync,null_blk,ext4,1,64,write,4k,2,487249.5917,497219.1927,2.046%
sync,null_blk,ext4,64,64,write,4k,1,929425.3383,914689.1207,-1.586%
sync,null_blk,ext4,64,64,write,4k,2,958521.4652,915095.2603,-4.531%
libaio,null_blk,ext4,1,1,write,4k,1,395910.603,400561.348,1.175%
libaio,null_blk,ext4,1,1,write,4k,2,396258.2247,400644.0785,1.107%
libaio,null_blk,ext4,64,1,write,4k,1,924243.4423,880487.5171,-4.734%
libaio,null_blk,ext4,64,1,write,4k,2,935109.6594,925996.8002,-0.975%
libaio,null_blk,ext4,1,64,write,4k,1,394290.2903,397357.7547,0.778%
libaio,null_blk,ext4,1,64,write,4k,2,395621.0793,397579.9807,0.495%
libaio,null_blk,ext4,64,64,write,4k,1,936976.0683,912497.7002,-2.612%
libaio,null_blk,ext4,64,64,write,4k,2,958581.0279,898506.7995,-6.267%
io_uring,null_blk,xfs,1,1,randread,4k,1,382210.293,387477.8174,1.378%
io_uring,null_blk,xfs,1,1,randread,4k,2,383518.7494,386298.79,0.725%
io_uring,null_blk,xfs,64,1,randread,4k,1,639988.4341,658284.6572,2.859%
io_uring,null_blk,xfs,64,1,randread,4k,2,647722.0852,663779.5814,2.479%
io_uring,null_blk,xfs,1,64,randread,4k,1,390716.4761,396363.9879,1.445%
io_uring,null_blk,xfs,1,64,randread,4k,2,390251.6249,394199.56,1.012%
io_uring,null_blk,xfs,64,64,randread,4k,1,642684.5544,657015.2985,2.230%
io_uring,null_blk,xfs,64,64,randread,4k,2,642769.5487,653850.31,1.724%
sync,null_blk,xfs,1,1,randread,4k,1,400599.98,410874.8708,2.565%
sync,null_blk,xfs,1,1,randread,4k,2,400322.6892,409062.1979,2.183%
sync,null_blk,xfs,64,1,randread,4k,1,651367.2755,670008.4994,2.862%
sync,null_blk,xfs,64,1,randread,4k,2,652621.4586,668074.7308,2.368%
sync,null_blk,xfs,1,64,randread,4k,1,399825.9725,410219.2594,2.599%
sync,null_blk,xfs,1,64,randread,4k,2,401054.2315,408359.288,1.821%
sync,null_blk,xfs,64,64,randread,4k,1,649330.9446,661720.252,1.908%
sync,null_blk,xfs,64,64,randread,4k,2,651800.0067,668580.5753,2.574%
libaio,null_blk,xfs,1,1,randread,4k,1,345804.1732,353446.9518,2.210%
libaio,null_blk,xfs,1,1,randread,4k,2,347019.5993,353842.1719,1.966%
libaio,null_blk,xfs,64,1,randread,4k,1,644237.2254,661020.666,2.605%
libaio,null_blk,xfs,64,1,randread,4k,2,643638.1241,662333.8777,2.905%
libaio,null_blk,xfs,1,64,randread,4k,1,345286.4571,351982.4673,1.939%
libaio,null_blk,xfs,1,64,randread,4k,2,345290.957,352179.1274,1.995%
libaio,null_blk,xfs,64,64,randread,4k,1,641296.4802,659925.7358,2.905%
libaio,null_blk,xfs,64,64,randread,4k,2,642865.7711,659663.9891,2.613%
io_uring,null_blk,xfs,1,1,randwrite,4k,1,341422.5192,346381.8873,1.453%
io_uring,null_blk,xfs,1,1,randwrite,4k,2,341789.4737,345391.1203,1.054%
io_uring,null_blk,xfs,64,1,randwrite,4k,1,582792.7805,589848.2768,1.211%
io_uring,null_blk,xfs,64,1,randwrite,4k,2,583694.4204,586990.334,0.565%
io_uring,null_blk,xfs,1,64,randwrite,4k,1,336812.7396,336677.9774,-0.040%
io_uring,null_blk,xfs,1,64,randwrite,4k,2,335610.5796,334344.4885,-0.377%
io_uring,null_blk,xfs,64,64,randwrite,4k,1,360778.3811,357508.028,-0.906%
io_uring,null_blk,xfs,64,64,randwrite,4k,2,359898.2012,358885.739,-0.281%
sync,null_blk,xfs,1,1,randwrite,4k,1,348604.2132,355655.1115,2.023%
sync,null_blk,xfs,1,1,randwrite,4k,2,350355.9881,352763.3412,0.687%
sync,null_blk,xfs,64,1,randwrite,4k,1,585158.0561,591713.4096,1.120%
sync,null_blk,xfs,64,1,randwrite,4k,2,585178.6607,593133.3911,1.359%
sync,null_blk,xfs,1,64,randwrite,4k,1,351992.6336,356332.7222,1.233%
sync,null_blk,xfs,1,64,randwrite,4k,2,351914.8695,356104.2965,1.190%
sync,null_blk,xfs,64,64,randwrite,4k,1,584714.719,586764.3824,0.351%
sync,null_blk,xfs,64,64,randwrite,4k,2,580578.0807,586508.3328,1.021%
libaio,null_blk,xfs,1,1,randwrite,4k,1,309463.1512,314567.1811,1.649%
libaio,null_blk,xfs,1,1,randwrite,4k,2,308786.2738,314242.0586,1.767%
libaio,null_blk,xfs,64,1,randwrite,4k,1,586844.5437,596860.0047,1.707%
libaio,null_blk,xfs,64,1,randwrite,4k,2,587218.5854,594149.3851,1.180%
libaio,null_blk,xfs,1,64,randwrite,4k,1,303010.833,307700.8433,1.548%
libaio,null_blk,xfs,1,64,randwrite,4k,2,302874.9708,306811.473,1.300%
libaio,null_blk,xfs,64,64,randwrite,4k,1,580672.0219,588167.7555,1.291%
libaio,null_blk,xfs,64,64,randwrite,4k,2,585894.6035,590113.5295,0.720%
io_uring,null_blk,xfs,1,1,read,4k,1,485992.3669,497211.393,2.308%
io_uring,null_blk,xfs,1,1,read,4k,2,485731.2756,496241.392,2.164%
io_uring,null_blk,xfs,64,1,read,4k,1,1386754.35,1422710.686,2.593%
io_uring,null_blk,xfs,64,1,read,4k,2,1383932.538,1438730.551,3.960%
io_uring,null_blk,xfs,1,64,read,4k,1,485657.8447,498276.1241,2.598%
io_uring,null_blk,xfs,1,64,read,4k,2,488612.2463,497339.1554,1.786%
io_uring,null_blk,xfs,64,64,read,4k,1,1371083.631,1426198.413,4.020%
io_uring,null_blk,xfs,64,64,read,4k,2,1375859.109,1414827.317,2.832%
sync,null_blk,xfs,1,1,read,4k,1,533477.6174,551839.4387,3.442%
sync,null_blk,xfs,1,1,read,4k,2,533492.2503,550358.988,3.162%
sync,null_blk,xfs,64,1,read,4k,1,1341965.136,1435340.011,6.958%
sync,null_blk,xfs,64,1,read,4k,2,1389147.89,1447626.058,4.210%
sync,null_blk,xfs,1,64,read,4k,1,532819.0394,549912.3696,3.208%
sync,null_blk,xfs,1,64,read,4k,2,532303.8899,548715.7428,3.083%
sync,null_blk,xfs,64,64,read,4k,1,1376722.085,1448107.726,5.185%
sync,null_blk,xfs,64,64,read,4k,2,1388553.563,1447462.103,4.242%
libaio,null_blk,xfs,1,1,read,4k,1,424680.5107,438466.2845,3.246%
libaio,null_blk,xfs,1,1,read,4k,2,425750.3083,433780.7406,1.886%
libaio,null_blk,xfs,64,1,read,4k,1,1358483.134,1417734.118,4.362%
libaio,null_blk,xfs,64,1,read,4k,2,1363599.56,1423660.389,4.405%
libaio,null_blk,xfs,1,64,read,4k,1,421954.3349,435920.2027,3.310%
libaio,null_blk,xfs,1,64,read,4k,2,421207.6264,436480.9173,3.626%
libaio,null_blk,xfs,64,64,read,4k,1,1360670.355,1418753.042,4.269%
libaio,null_blk,xfs,64,64,read,4k,2,1349828.306,1412889.941,4.672%
io_uring,null_blk,xfs,1,1,write,4k,1,386096.3635,394670.211,2.221%
io_uring,null_blk,xfs,1,1,write,4k,2,389804.0399,394263.6245,1.144%
io_uring,null_blk,xfs,64,1,write,4k,1,918456.5029,921686.9875,0.352%
io_uring,null_blk,xfs,64,1,write,4k,2,892779.0814,912357.2429,2.193%
io_uring,null_blk,xfs,1,64,write,4k,1,385399.92,393616.0795,2.132%
io_uring,null_blk,xfs,1,64,write,4k,2,386323.7892,393550.1817,1.871%
io_uring,null_blk,xfs,64,64,write,4k,1,374968.2878,382632.5538,2.044%
io_uring,null_blk,xfs,64,64,write,4k,2,377468.572,381528.0775,1.075%
sync,null_blk,xfs,1,1,write,4k,1,419403.6532,428578.5141,2.188%
sync,null_blk,xfs,1,1,write,4k,2,419813.3396,429057.5647,2.202%
sync,null_blk,xfs,64,1,write,4k,1,906057.7295,920532.0979,1.598%
sync,null_blk,xfs,64,1,write,4k,2,922710.8193,912984.2339,-1.054%
sync,null_blk,xfs,1,64,write,4k,1,420090.797,426406.8198,1.503%
sync,null_blk,xfs,1,64,write,4k,2,417122.4293,429010.9663,2.850%
sync,null_blk,xfs,64,64,write,4k,1,870955.6015,917991.8005,5.401%
sync,null_blk,xfs,64,64,write,4k,2,869305.2463,897781.8145,3.276%
libaio,null_blk,xfs,1,1,write,4k,1,346572.1476,355278.2574,2.512%
libaio,null_blk,xfs,1,1,write,4k,2,346859.7713,354795.0068,2.288%
libaio,null_blk,xfs,64,1,write,4k,1,891152.4232,911940.5373,2.333%
libaio,null_blk,xfs,64,1,write,4k,2,898361.3759,924404.373,2.899%
libaio,null_blk,xfs,1,64,write,4k,1,345476.9508,351506.8498,1.745%
libaio,null_blk,xfs,1,64,write,4k,2,346031.6989,351181.2273,1.488%
libaio,null_blk,xfs,64,64,write,4k,1,909579.928,909777.8481,0.022%
libaio,null_blk,xfs,64,64,write,4k,2,927882.5412,952763.9491,2.682%
[-- Attachment #3: fio_results.csv --]
[-- Type: text/csv, Size: 12529 bytes --]
engine,medium,fs_or_raw,numjobs,qdepth,pattern,bs,repeat_id,IOPS,new_IOPS,diff
io_uring,ext4,fs,1,1,randwrite,4k,1,115867.5189,115666.0222,-0.174%
io_uring,ext4,fs,1,1,randwrite,4k,2,115803.7699,115459.9257,-0.297%
io_uring,ext4,fs,1,1,randwrite,4k,3,100477.942,99979.01702,-0.497%
io_uring,ext4,fs,1,1,randwrite,4k,4,100484.6253,99829.51951,-0.652%
io_uring,ext4,fs,64,1,randwrite,4k,1,503606.703,504401.37,0.158%
io_uring,ext4,fs,64,1,randwrite,4k,2,502777.8074,495796.4367,-1.389%
io_uring,ext4,fs,64,1,randwrite,4k,3,516077.0474,508301.5899,-1.507%
io_uring,ext4,fs,64,1,randwrite,4k,4,507994.1002,519392.6369,2.244%
io_uring,ext4,fs,1,64,randwrite,4k,1,281186.4136,280456.4257,-0.260%
io_uring,ext4,fs,1,64,randwrite,4k,2,279691.2885,279392.5435,-0.107%
io_uring,ext4,fs,1,64,randwrite,4k,3,347558.0907,345833.0694,-0.496%
io_uring,ext4,fs,1,64,randwrite,4k,4,346550.7908,344778.5704,-0.511%
io_uring,ext4,fs,64,64,randwrite,4k,1,510909.5711,512303.4994,0.273%
io_uring,ext4,fs,64,64,randwrite,4k,2,513191.8982,510962.3396,-0.434%
io_uring,ext4,fs,64,64,randwrite,4k,3,507355.0242,506253.5411,-0.217%
io_uring,ext4,fs,64,64,randwrite,4k,4,498739.0558,510080.5546,2.274%
sync,ext4,fs,1,1,randwrite,4k,1,126708.3382,126618.723,-0.071%
sync,ext4,fs,1,1,randwrite,4k,2,126438.476,126946.4676,0.402%
sync,ext4,fs,1,1,randwrite,4k,3,111325.8279,111167.7972,-0.142%
sync,ext4,fs,1,1,randwrite,4k,4,111632.4728,111031.2328,-0.539%
sync,ext4,fs,64,1,randwrite,4k,1,511903.2699,514286.9238,0.466%
sync,ext4,fs,64,1,randwrite,4k,2,511368.7649,512633.5955,0.247%
sync,ext4,fs,64,1,randwrite,4k,3,512995.5334,508858.4214,-0.806%
sync,ext4,fs,64,1,randwrite,4k,4,511347.8884,504660.878,-1.308%
sync,ext4,fs,1,64,randwrite,4k,1,126459.8423,126626.5896,0.132%
sync,ext4,fs,1,64,randwrite,4k,2,126489.2252,126578.3404,0.070%
sync,ext4,fs,1,64,randwrite,4k,3,111640.006,111070.9822,-0.510%
sync,ext4,fs,1,64,randwrite,4k,4,111427.3929,111189.2135,-0.214%
sync,ext4,fs,64,64,randwrite,4k,1,503391.4435,514909.1182,2.288%
sync,ext4,fs,64,64,randwrite,4k,2,502241.446,512134.8788,1.970%
sync,ext4,fs,64,64,randwrite,4k,3,506979.5007,506982.8006,0.001%
sync,ext4,fs,64,64,randwrite,4k,4,510155.3974,507549.965,-0.511%
libaio,ext4,fs,1,1,randwrite,4k,1,113512.4748,112812.6865,-0.616%
libaio,ext4,fs,1,1,randwrite,4k,2,113303.8949,113217.1797,-0.077%
libaio,ext4,fs,1,1,randwrite,4k,3,98153.8141,97065.81557,-1.108%
libaio,ext4,fs,1,1,randwrite,4k,4,97855.18575,97880.152,0.026%
libaio,ext4,fs,64,1,randwrite,4k,1,515133.4122,507434.0355,-1.495%
libaio,ext4,fs,64,1,randwrite,4k,2,511213.2096,508732.4878,-0.485%
libaio,ext4,fs,64,1,randwrite,4k,3,511367.6605,504420.8263,-1.358%
libaio,ext4,fs,64,1,randwrite,4k,4,504613.5462,510156.2448,1.098%
libaio,ext4,fs,1,64,randwrite,4k,1,255959.734,255683.3719,-0.108%
libaio,ext4,fs,1,64,randwrite,4k,2,254772.1871,252148.5975,-1.030%
libaio,ext4,fs,1,64,randwrite,4k,3,317763.7373,315496.6417,-0.713%
libaio,ext4,fs,1,64,randwrite,4k,4,316768.1705,316151.9641,-0.195%
libaio,ext4,fs,64,64,randwrite,4k,1,508003.4494,509628.6057,0.320%
libaio,ext4,fs,64,64,randwrite,4k,2,504722.5462,503461.0308,-0.250%
libaio,ext4,fs,64,64,randwrite,4k,3,510652.2471,508277.1084,-0.465%
libaio,ext4,fs,64,64,randwrite,4k,4,511954.8916,502357.7904,-1.875%
io_uring,ext4,fs,1,1,randread,4k,1,18482.54196,18494.92509,0.067%
io_uring,ext4,fs,1,1,randread,4k,2,18488.04187,18455.7424,-0.175%
io_uring,ext4,fs,1,1,randread,4k,3,18075.11542,18094.83175,0.109%
io_uring,ext4,fs,1,1,randread,4k,4,18100.03167,18091.23181,-0.049%
io_uring,ext4,fs,64,1,randread,4k,1,1006960.985,1001538.899,-0.538%
io_uring,ext4,fs,64,1,randread,4k,2,1007058.615,1001559.055,-0.546%
io_uring,ext4,fs,64,1,randread,4k,3,1007081.063,1001774.024,-0.527%
io_uring,ext4,fs,64,1,randread,4k,4,1007291.519,1001726.842,-0.552%
io_uring,ext4,fs,1,64,randread,4k,1,401976.4004,408141.0476,1.534%
io_uring,ext4,fs,1,64,randread,4k,2,401244.3126,406759.7373,1.375%
io_uring,ext4,fs,1,64,randread,4k,3,422803.8699,420010.2665,-0.661%
io_uring,ext4,fs,1,64,randread,4k,4,424580.607,420310.4448,-1.006%
io_uring,ext4,fs,64,64,randread,4k,1,2139208.36,2158491.134,0.901%
io_uring,ext4,fs,64,64,randread,4k,2,2209777.124,2233999.233,1.096%
io_uring,ext4,fs,64,64,randread,4k,3,2281433.619,2309940.669,1.250%
io_uring,ext4,fs,64,64,randread,4k,4,2359551.752,2386257.808,1.132%
sync,ext4,fs,1,1,randread,4k,1,18476.04207,18480.49199,0.024%
sync,ext4,fs,1,1,randread,4k,2,18493.47511,18486.0419,-0.040%
sync,ext4,fs,1,1,randread,4k,3,18111.94813,18083.14861,-0.159%
sync,ext4,fs,1,1,randread,4k,4,18103.9316,18095.24841,-0.048%
sync,ext4,fs,64,1,randread,4k,1,998352.3549,1002873.804,0.453%
sync,ext4,fs,64,1,randread,4k,2,998359.438,1002585.48,0.423%
sync,ext4,fs,64,1,randread,4k,3,998428.1595,1002641.679,0.422%
sync,ext4,fs,64,1,randread,4k,4,998538.0487,1002745.042,0.421%
sync,ext4,fs,1,64,randread,4k,1,18493.22511,18481.67531,-0.062%
sync,ext4,fs,1,64,randread,4k,2,18478.45869,18483.12528,0.025%
sync,ext4,fs,1,64,randread,4k,3,18111.94813,18093.56511,-0.101%
sync,ext4,fs,1,64,randread,4k,4,18106.79822,18092.06513,-0.081%
sync,ext4,fs,64,64,randread,4k,1,998917.0194,1000278.903,0.136%
sync,ext4,fs,64,64,randread,4k,2,998940.3687,999982.2342,0.104%
sync,ext4,fs,64,64,randread,4k,3,998910.603,999957.3014,0.105%
sync,ext4,fs,64,64,randread,4k,4,999207.3396,1000397.347,0.119%
libaio,ext4,fs,1,1,randread,4k,1,18418.37636,18417.15971,-0.007%
libaio,ext4,fs,1,1,randread,4k,2,18420.62632,18426.32623,0.031%
libaio,ext4,fs,1,1,randread,4k,3,18010.2665,18003.49994,-0.038%
libaio,ext4,fs,1,1,randread,4k,4,18007.23321,18000.89999,-0.035%
libaio,ext4,fs,64,1,randread,4k,1,1001835.222,1001078.397,-0.076%
libaio,ext4,fs,64,1,randread,4k,2,1001390.637,1001264.241,-0.013%
libaio,ext4,fs,64,1,randread,4k,3,1001742.196,1001120.646,-0.062%
libaio,ext4,fs,64,1,randread,4k,4,1001398.137,1001312.106,-0.009%
libaio,ext4,fs,1,64,randread,4k,1,358446.3592,362742.671,1.199%
libaio,ext4,fs,1,64,randread,4k,2,358805.0199,361871.1855,0.855%
libaio,ext4,fs,1,64,randread,4k,3,387196.0301,384922.8513,-0.587%
libaio,ext4,fs,1,64,randread,4k,4,387650.7225,384980.917,-0.689%
libaio,ext4,fs,64,64,randread,4k,1,2300850.788,2383572.964,3.595%
libaio,ext4,fs,64,64,randread,4k,2,2384478.634,2460665.611,3.195%
libaio,ext4,fs,64,64,randread,4k,3,2456699.977,2544566.455,3.577%
libaio,ext4,fs,64,64,randread,4k,4,2544092.912,2647977.001,4.083%
io_uring,ext4,fs,1,1,write,4k,1,119558.4074,119346.4109,-0.177%
io_uring,ext4,fs,1,1,write,4k,2,119481.2753,119973.5338,0.412%
io_uring,ext4,fs,1,1,write,4k,3,103498.4417,102979.5503,-0.501%
io_uring,ext4,fs,1,1,write,4k,4,103206.5966,102901.6683,-0.295%
io_uring,ext4,fs,64,1,write,4k,1,913396.1868,1003953.752,9.914%
io_uring,ext4,fs,64,1,write,4k,2,924664.6945,1087612.746,17.622%
io_uring,ext4,fs,64,1,write,4k,3,797902.1382,874398.3701,9.587%
io_uring,ext4,fs,64,1,write,4k,4,932975.0508,1135695.627,21.728%
io_uring,ext4,fs,1,64,write,4k,1,303905.5016,305408.4765,0.495%
io_uring,ext4,fs,1,64,write,4k,2,303861.4023,307353.8774,1.149%
io_uring,ext4,fs,1,64,write,4k,3,388813.6031,386202.78,-0.671%
io_uring,ext4,fs,1,64,write,4k,4,389511.4748,385477.692,-1.036%
io_uring,ext4,fs,64,64,write,4k,1,867203.1596,857466.37,-1.123%
io_uring,ext4,fs,64,64,write,4k,2,800109.1391,827276.1437,3.395%
io_uring,ext4,fs,64,64,write,4k,3,844131.4614,835928.2738,-0.972%
io_uring,ext4,fs,64,64,write,4k,4,774375.8207,795545.5621,2.734%
sync,ext4,fs,1,1,write,4k,1,132848.8025,132503.7749,-0.260%
sync,ext4,fs,1,1,write,4k,2,133075.0987,132712.8215,-0.272%
sync,ext4,fs,1,1,write,4k,3,116470.7922,116056.5157,-0.356%
sync,ext4,fs,1,1,write,4k,4,116569.9405,116076.6987,-0.423%
sync,ext4,fs,64,1,write,4k,1,970370.8043,965151.9783,-0.538%
sync,ext4,fs,64,1,write,4k,2,869822.7089,846955.9348,-2.629%
sync,ext4,fs,64,1,write,4k,3,868489.3755,1056152.995,21.608%
sync,ext4,fs,64,1,write,4k,4,801865.3878,783007.4663,-2.352%
sync,ext4,fs,1,64,write,4k,1,132824.9529,132756.2707,-0.052%
sync,ext4,fs,1,64,write,4k,2,132869.4188,132679.4553,-0.143%
sync,ext4,fs,1,64,write,4k,3,116559.3407,115783.7203,-0.665%
sync,ext4,fs,1,64,write,4k,4,116682.322,116039.4327,-0.551%
sync,ext4,fs,64,64,write,4k,1,1048048.248,1087531.59,3.767%
sync,ext4,fs,64,64,write,4k,2,873580.0973,839478.5848,-3.904%
sync,ext4,fs,64,64,write,4k,3,876619.5524,873358.3214,-0.372%
sync,ext4,fs,64,64,write,4k,4,893801.0233,921529.4157,3.102%
libaio,ext4,fs,1,1,write,4k,1,117102.3816,117266.5289,0.140%
libaio,ext4,fs,1,1,write,4k,2,117154.7141,117296.7451,0.121%
libaio,ext4,fs,1,1,write,4k,3,100993.6334,100913.2848,-0.080%
libaio,ext4,fs,1,1,write,4k,4,101252.7291,100749.3042,-0.497%
libaio,ext4,fs,64,1,write,4k,1,958395.8701,892410.1598,-6.885%
libaio,ext4,fs,64,1,write,4k,2,791037.516,878965.8678,11.116%
libaio,ext4,fs,64,1,write,4k,3,956797.7734,1075807.206,12.438%
libaio,ext4,fs,64,1,write,4k,4,952507.6997,1038382.421,9.016%
libaio,ext4,fs,1,64,write,4k,1,290670.5722,290688.2052,0.006%
libaio,ext4,fs,1,64,write,4k,2,290089.7652,290748.1209,0.227%
libaio,ext4,fs,1,64,write,4k,3,360941.2843,357604.5399,-0.924%
libaio,ext4,fs,1,64,write,4k,4,360436.8261,354050.2825,-1.772%
libaio,ext4,fs,64,64,write,4k,1,808392.3359,874178.1959,8.138%
libaio,ext4,fs,64,64,write,4k,2,1002163.22,944975.8211,-5.706%
libaio,ext4,fs,64,64,write,4k,3,764765.794,843904.8428,10.348%
libaio,ext4,fs,64,64,write,4k,4,802663.6892,800695.9971,-0.245%
io_uring,ext4,fs,1,1,read,4k,1,93739.32101,93923.05128,0.196%
io_uring,ext4,fs,1,1,read,4k,2,93736.3044,94038.99935,0.323%
io_uring,ext4,fs,1,1,read,4k,3,84393.82677,84731.80447,0.400%
io_uring,ext4,fs,1,1,read,4k,4,84985.51691,84620.28966,-0.430%
io_uring,ext4,fs,64,1,read,4k,1,1008894.304,1006360.271,-0.251%
io_uring,ext4,fs,64,1,read,4k,2,1006970.951,1010080.814,0.309%
io_uring,ext4,fs,64,1,read,4k,3,999283.6905,1010584.081,1.131%
io_uring,ext4,fs,64,1,read,4k,4,1008668.3,998783.0572,-0.980%
io_uring,ext4,fs,1,64,read,4k,1,437338.9777,450513.5248,3.012%
io_uring,ext4,fs,1,64,read,4k,2,439465.2422,450271.5288,2.459%
io_uring,ext4,fs,1,64,read,4k,3,452392.3935,447926.6012,-0.987%
io_uring,ext4,fs,1,64,read,4k,4,452892.7685,450307.1782,-0.571%
io_uring,ext4,fs,64,64,read,4k,1,2392849.505,2500747.163,4.509%
io_uring,ext4,fs,64,64,read,4k,2,2389899.337,2612257.791,9.304%
io_uring,ext4,fs,64,64,read,4k,3,2393198.293,2609915.238,9.056%
io_uring,ext4,fs,64,64,read,4k,4,2393286.674,2609664.395,9.041%
sync,ext4,fs,1,1,read,4k,1,94205.79657,94353.72744,0.157%
sync,ext4,fs,1,1,read,4k,2,94227.76287,94179.06368,-0.052%
sync,ext4,fs,1,1,read,4k,3,86337.84437,85536.82439,-0.928%
sync,ext4,fs,1,1,read,4k,4,86339.62767,85537.82437,-0.929%
sync,ext4,fs,64,1,read,4k,1,988017.9827,1008469.984,2.070%
sync,ext4,fs,64,1,read,4k,2,1002525.549,997838.8887,-0.467%
sync,ext4,fs,64,1,read,4k,3,1007055.581,1008677.911,0.161%
sync,ext4,fs,64,1,read,4k,4,1000917.787,992595.0802,-0.832%
sync,ext4,fs,1,64,read,4k,1,94230.2795,94387.24355,0.167%
sync,ext4,fs,1,64,read,4k,2,94181.09698,94364.66059,0.195%
sync,ext4,fs,1,64,read,4k,3,86279.62867,85733.8211,-0.633%
sync,ext4,fs,1,64,read,4k,4,86133.74777,85653.28911,-0.558%
sync,ext4,fs,64,64,read,4k,1,1005159.011,1004259.308,-0.090%
sync,ext4,fs,64,64,read,4k,2,1014506.733,1015827.125,0.130%
sync,ext4,fs,64,64,read,4k,3,1004319.206,1004093.03,-0.023%
sync,ext4,fs,64,64,read,4k,4,1006850.955,1014990.134,0.808%
libaio,ext4,fs,1,1,read,4k,1,92506.15823,92544.72426,0.042%
libaio,ext4,fs,1,1,read,4k,2,92473.97543,92801.45331,0.354%
libaio,ext4,fs,1,1,read,4k,3,82473.59211,82663.10562,0.230%
libaio,ext4,fs,1,1,read,4k,4,82714.80475,82496.45839,-0.264%
libaio,ext4,fs,64,1,read,4k,1,995352.5382,1012021.333,1.675%
libaio,ext4,fs,64,1,read,4k,2,1001252.742,1010824.889,0.956%
libaio,ext4,fs,64,1,read,4k,3,1004219.876,995236.2588,-0.895%
libaio,ext4,fs,64,1,read,4k,4,1008955.968,997126.2104,-1.172%
libaio,ext4,fs,1,64,read,4k,1,389365.5772,389788.7369,0.109%
libaio,ext4,fs,1,64,read,4k,2,388373.8438,391467.1922,0.796%
libaio,ext4,fs,1,64,read,4k,3,408649.8225,404100.0983,-1.113%
libaio,ext4,fs,1,64,read,4k,4,409032.4495,404696.6384,-1.060%
libaio,ext4,fs,64,64,read,4k,1,3084870.473,3116452.061,1.024%
libaio,ext4,fs,64,64,read,4k,2,3066626.685,3091609.903,0.815%
libaio,ext4,fs,64,64,read,4k,3,3098613.226,3101277.553,0.086%
libaio,ext4,fs,64,64,read,4k,4,2867552.772,3080328.4,7.420%
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] block: enable per-cpu bio cache by default
2025-10-11 1:36 ` fengnan chang
@ 2025-10-11 1:43 ` fengnan chang
0 siblings, 0 replies; 11+ messages in thread
From: fengnan chang @ 2025-10-11 1:43 UTC (permalink / raw)
To: Fengnan Chang, linux-block
Cc: axboe, viro, brauner, jack, asml.silence, willy, djwong, hch,
ritesh.list, linux-fsdevel, io-uring, linux-xfs, linux-ext4,
linux-kernel
cc more maillist
On Sat, Oct 11, 2025 at 9:36 AM fengnan chang <fengnanchang@gmail.com> wrote:
>
> The attachment is result of fio test ext4/xfs with
> libaio/sync/io_uring on null_blk and
> nvme.
>
> On Sat, Oct 11, 2025 at 9:33 AM Fengnan Chang
> <changfengnan@bytedance.com> wrote:
> >
> > Per cpu bio cache was only used in the io_uring + raw block device,
> > after commit 12e4e8c7ab59 ("io_uring/rw: enable bio caches for IRQ
> > rw"), bio_put is safe for task and irq context, bio_alloc_bioset is
> > safe for task context and no one calls in irq context, so we can enable
> > per cpu bio cache by default.
> >
> > Benchmarked with t/io_uring and ext4+nvme:
> > taskset -c 6 /root/fio/t/io_uring -p0 -d128 -b4096 -s1 -c1 -F1 -B1 -R1
> > -X1 -n1 -P1 /mnt/testfile
> > base IOPS is 562K, patch IOPS is 574K. The CPU usage of bio_alloc_bioset
> > decrease from 1.42% to 1.22%.
> >
> > The worst case is allocate bio in CPU A but free in CPU B, still use
> > t/io_uring and ext4+nvme:
> > base IOPS is 648K, patch IOPS is 647K.
> >
> > Also use fio test ext4/xfs with libaio/sync/io_uring on null_blk and
> > nvme, no obvious performance regression.
> >
> > Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
> > ---
> > block/bio.c | 26 ++++++++++++--------------
> > block/blk-map.c | 4 ++++
> > block/fops.c | 4 ----
> > include/linux/fs.h | 3 ---
> > io_uring/rw.c | 1 -
> > 5 files changed, 16 insertions(+), 22 deletions(-)
> >
> > diff --git a/block/bio.c b/block/bio.c
> > index 3b371a5da159..16b20c10cab7 100644
> > --- a/block/bio.c
> > +++ b/block/bio.c
> > @@ -513,20 +513,18 @@ struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs,
> > if (WARN_ON_ONCE(!mempool_initialized(&bs->bvec_pool) && nr_vecs > 0))
> > return NULL;
> >
> > - if (opf & REQ_ALLOC_CACHE) {
> > - if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
> > - bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
> > - gfp_mask, bs);
> > - if (bio)
> > - return bio;
> > - /*
> > - * No cached bio available, bio returned below marked with
> > - * REQ_ALLOC_CACHE to particpate in per-cpu alloc cache.
> > - */
> > - } else {
> > - opf &= ~REQ_ALLOC_CACHE;
> > - }
> > - }
> > + opf |= REQ_ALLOC_CACHE;
> > + if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
> > + bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
> > + gfp_mask, bs);
> > + if (bio)
> > + return bio;
> > + /*
> > + * No cached bio available, bio returned below marked with
> > + * REQ_ALLOC_CACHE to participate in per-cpu alloc cache.
> > + */
> > + } else
> > + opf &= ~REQ_ALLOC_CACHE;
> >
> > /*
> > * submit_bio_noacct() converts recursion to iteration; this means if
> > diff --git a/block/blk-map.c b/block/blk-map.c
> > index 23e5d5ebe59e..570a7ca6edd1 100644
> > --- a/block/blk-map.c
> > +++ b/block/blk-map.c
> > @@ -255,6 +255,10 @@ static struct bio *blk_rq_map_bio_alloc(struct request *rq,
> > {
> > struct bio *bio;
> >
> > + /*
> > + * Even REQ_ALLOC_CACHE is enabled by default, we still need this to
> > + * mark bio is allocated by bio_alloc_bioset.
> > + */
> > 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);
> > diff --git a/block/fops.c b/block/fops.c
> > index ddbc69c0922b..090562a91b4c 100644
> > --- a/block/fops.c
> > +++ b/block/fops.c
> > @@ -177,8 +177,6 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
> > loff_t pos = iocb->ki_pos;
> > int ret = 0;
> >
> > - if (iocb->ki_flags & IOCB_ALLOC_CACHE)
> > - opf |= REQ_ALLOC_CACHE;
> > bio = bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL,
> > &blkdev_dio_pool);
> > dio = container_of(bio, struct blkdev_dio, bio);
> > @@ -326,8 +324,6 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb,
> > loff_t pos = iocb->ki_pos;
> > int ret = 0;
> >
> > - if (iocb->ki_flags & IOCB_ALLOC_CACHE)
> > - opf |= REQ_ALLOC_CACHE;
> > bio = bio_alloc_bioset(bdev, nr_pages, opf, GFP_KERNEL,
> > &blkdev_dio_pool);
> > dio = container_of(bio, struct blkdev_dio, bio);
> > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > index 601d036a6c78..18ec41732186 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -365,8 +365,6 @@ struct readahead_control;
> > /* iocb->ki_waitq is valid */
> > #define IOCB_WAITQ (1 << 19)
> > #define IOCB_NOIO (1 << 20)
> > -/* can use bio alloc cache */
> > -#define IOCB_ALLOC_CACHE (1 << 21)
> > /*
> > * IOCB_DIO_CALLER_COMP can be set by the iocb owner, to indicate that the
> > * iocb completion can be passed back to the owner for execution from a safe
> > @@ -399,7 +397,6 @@ struct readahead_control;
> > { IOCB_WRITE, "WRITE" }, \
> > { IOCB_WAITQ, "WAITQ" }, \
> > { IOCB_NOIO, "NOIO" }, \
> > - { IOCB_ALLOC_CACHE, "ALLOC_CACHE" }, \
> > { IOCB_DIO_CALLER_COMP, "CALLER_COMP" }, \
> > { IOCB_AIO_RW, "AIO_RW" }, \
> > { IOCB_HAS_METADATA, "AIO_HAS_METADATA" }
> > diff --git a/io_uring/rw.c b/io_uring/rw.c
> > index af5a54b5db12..fa7655ab9097 100644
> > --- a/io_uring/rw.c
> > +++ b/io_uring/rw.c
> > @@ -856,7 +856,6 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type)
> > ret = kiocb_set_rw_flags(kiocb, rw->flags, rw_type);
> > if (unlikely(ret))
> > return ret;
> > - kiocb->ki_flags |= IOCB_ALLOC_CACHE;
> >
> > /*
> > * If the file is marked O_NONBLOCK, still allow retry for it if it
> > --
> > 2.39.5 (Apple Git-154)
> >
> >
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] block: enable per-cpu bio cache by default
2025-10-11 1:33 [PATCH] block: enable per-cpu bio cache by default Fengnan Chang
2025-10-11 1:36 ` fengnan chang
@ 2025-10-13 3:24 ` Christoph Hellwig
2025-10-13 5:42 ` fengnan chang
2025-10-13 5:18 ` Ming Lei
2 siblings, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2025-10-13 3:24 UTC (permalink / raw)
To: Fengnan Chang
Cc: axboe, viro, brauner, jack, asml.silence, willy, djwong, hch,
ritesh.list, linux-fsdevel, io-uring, linux-xfs, linux-ext4
On Sat, Oct 11, 2025 at 09:33:12AM +0800, Fengnan Chang wrote:
> + opf |= REQ_ALLOC_CACHE;
> + if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
> + bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
> + gfp_mask, bs);
> + if (bio)
> + return bio;
> + /*
> + * No cached bio available, bio returned below marked with
> + * REQ_ALLOC_CACHE to participate in per-cpu alloc cache.
> + */
> + } else
> + opf &= ~REQ_ALLOC_CACHE;
Just set the req flag in the branch instead of unconditionally setting
it and then clearing it.
> + /*
> + * Even REQ_ALLOC_CACHE is enabled by default, we still need this to
> + * mark bio is allocated by bio_alloc_bioset.
> + */
> if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) {
I can't really parse the comment, can you explain what you mean?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] block: enable per-cpu bio cache by default
2025-10-11 1:33 [PATCH] block: enable per-cpu bio cache by default Fengnan Chang
2025-10-11 1:36 ` fengnan chang
2025-10-13 3:24 ` Christoph Hellwig
@ 2025-10-13 5:18 ` Ming Lei
2025-10-13 5:44 ` fengnan chang
2 siblings, 1 reply; 11+ messages in thread
From: Ming Lei @ 2025-10-13 5:18 UTC (permalink / raw)
To: Fengnan Chang
Cc: axboe, viro, brauner, jack, asml.silence, willy, djwong, hch,
ritesh.list, linux-fsdevel, io-uring, linux-xfs, linux-ext4
On Sat, Oct 11, 2025 at 09:33:12AM +0800, Fengnan Chang wrote:
> Per cpu bio cache was only used in the io_uring + raw block device,
> after commit 12e4e8c7ab59 ("io_uring/rw: enable bio caches for IRQ
> rw"), bio_put is safe for task and irq context, bio_alloc_bioset is
> safe for task context and no one calls in irq context, so we can enable
> per cpu bio cache by default.
>
> Benchmarked with t/io_uring and ext4+nvme:
> taskset -c 6 /root/fio/t/io_uring -p0 -d128 -b4096 -s1 -c1 -F1 -B1 -R1
> -X1 -n1 -P1 /mnt/testfile
> base IOPS is 562K, patch IOPS is 574K. The CPU usage of bio_alloc_bioset
> decrease from 1.42% to 1.22%.
>
> The worst case is allocate bio in CPU A but free in CPU B, still use
> t/io_uring and ext4+nvme:
> base IOPS is 648K, patch IOPS is 647K.
Just be curious, how do you run the remote bio free test? If the nvme is 1:1
mapping, you may not trigger it.
BTW, ublk has this kind of remote bio free trouble, but not see IOPS drop
with this patch.
The patch itself looks fine for me.
Thanks,
Ming
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] block: enable per-cpu bio cache by default
2025-10-13 3:24 ` Christoph Hellwig
@ 2025-10-13 5:42 ` fengnan chang
2025-10-13 6:28 ` Christoph Hellwig
0 siblings, 1 reply; 11+ messages in thread
From: fengnan chang @ 2025-10-13 5:42 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Fengnan Chang, axboe, viro, brauner, jack, asml.silence, willy,
djwong, ritesh.list, linux-fsdevel, io-uring, linux-xfs,
linux-ext4
On Mon, Oct 13, 2025 at 11:25 AM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Sat, Oct 11, 2025 at 09:33:12AM +0800, Fengnan Chang wrote:
> > + opf |= REQ_ALLOC_CACHE;
> > + if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
> > + bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
> > + gfp_mask, bs);
> > + if (bio)
> > + return bio;
> > + /*
> > + * No cached bio available, bio returned below marked with
> > + * REQ_ALLOC_CACHE to participate in per-cpu alloc cache.
> > + */
> > + } else
>
> > + opf &= ~REQ_ALLOC_CACHE;
>
> Just set the req flag in the branch instead of unconditionally setting
> it and then clearing it.
clearing this flag is necessary, because bio_alloc_clone will call this in
boot stage, maybe the bs->cache of the new bio is not initialized yet.
>
> > + /*
> > + * Even REQ_ALLOC_CACHE is enabled by default, we still need this to
> > + * mark bio is allocated by bio_alloc_bioset.
> > + */
> > if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) {
>
> I can't really parse the comment, can you explain what you mean?
This is to tell others that REQ_ALLOC_CACHE can't be deleted here, and
that this flag
serves other purposes here.
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] block: enable per-cpu bio cache by default
2025-10-13 5:18 ` Ming Lei
@ 2025-10-13 5:44 ` fengnan chang
0 siblings, 0 replies; 11+ messages in thread
From: fengnan chang @ 2025-10-13 5:44 UTC (permalink / raw)
To: Ming Lei
Cc: Fengnan Chang, axboe, viro, brauner, jack, asml.silence, willy,
djwong, hch, ritesh.list, linux-fsdevel, io-uring, linux-xfs,
linux-ext4
On Mon, Oct 13, 2025 at 1:19 PM Ming Lei <ming.lei@redhat.com> wrote:
>
> On Sat, Oct 11, 2025 at 09:33:12AM +0800, Fengnan Chang wrote:
> > Per cpu bio cache was only used in the io_uring + raw block device,
> > after commit 12e4e8c7ab59 ("io_uring/rw: enable bio caches for IRQ
> > rw"), bio_put is safe for task and irq context, bio_alloc_bioset is
> > safe for task context and no one calls in irq context, so we can enable
> > per cpu bio cache by default.
> >
> > Benchmarked with t/io_uring and ext4+nvme:
> > taskset -c 6 /root/fio/t/io_uring -p0 -d128 -b4096 -s1 -c1 -F1 -B1 -R1
> > -X1 -n1 -P1 /mnt/testfile
> > base IOPS is 562K, patch IOPS is 574K. The CPU usage of bio_alloc_bioset
> > decrease from 1.42% to 1.22%.
> >
> > The worst case is allocate bio in CPU A but free in CPU B, still use
> > t/io_uring and ext4+nvme:
> > base IOPS is 648K, patch IOPS is 647K.
>
> Just be curious, how do you run the remote bio free test? If the nvme is 1:1
> mapping, you may not trigger it.
I modified the nvme driver, reduce the number of queues.
>
> BTW, ublk has this kind of remote bio free trouble, but not see IOPS drop
> with this patch.
>
> The patch itself looks fine for me.
>
>
> Thanks,
> Ming
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] block: enable per-cpu bio cache by default
2025-10-13 5:42 ` fengnan chang
@ 2025-10-13 6:28 ` Christoph Hellwig
2025-10-13 12:58 ` [External] " Fengnan Chang
0 siblings, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2025-10-13 6:28 UTC (permalink / raw)
To: fengnan chang
Cc: Christoph Hellwig, Fengnan Chang, axboe, viro, brauner, jack,
asml.silence, willy, djwong, ritesh.list, linux-fsdevel, io-uring,
linux-xfs, linux-ext4
On Mon, Oct 13, 2025 at 01:42:47PM +0800, fengnan chang wrote:
> > Just set the req flag in the branch instead of unconditionally setting
> > it and then clearing it.
>
> clearing this flag is necessary, because bio_alloc_clone will call this in
> boot stage, maybe the bs->cache of the new bio is not initialized yet.
Given that we're using the flag by default and setting it here,
bio_alloc_clone should not inherit it. In fact we should probably
figure out a way to remove it entirely, but if that is not possible
it should only be set when the cache was actually used.
> > > + /*
> > > + * Even REQ_ALLOC_CACHE is enabled by default, we still need this to
> > > + * mark bio is allocated by bio_alloc_bioset.
> > > + */
> > > if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) {
> >
> > I can't really parse the comment, can you explain what you mean?
>
> This is to tell others that REQ_ALLOC_CACHE can't be deleted here, and
> that this flag
> serves other purposes here.
So what can't it be deleted?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [External] Re: [PATCH] block: enable per-cpu bio cache by default
2025-10-13 6:28 ` Christoph Hellwig
@ 2025-10-13 12:58 ` Fengnan Chang
2025-10-13 13:31 ` Pavel Begunkov
0 siblings, 1 reply; 11+ messages in thread
From: Fengnan Chang @ 2025-10-13 12:58 UTC (permalink / raw)
To: Christoph Hellwig
Cc: fengnan chang, axboe, viro, brauner, jack, asml.silence, willy,
djwong, ritesh.list, linux-fsdevel, io-uring, linux-xfs,
linux-ext4
Christoph Hellwig <hch@infradead.org> 于2025年10月13日周一 14:28写道:
>
> On Mon, Oct 13, 2025 at 01:42:47PM +0800, fengnan chang wrote:
> > > Just set the req flag in the branch instead of unconditionally setting
> > > it and then clearing it.
> >
> > clearing this flag is necessary, because bio_alloc_clone will call this in
> > boot stage, maybe the bs->cache of the new bio is not initialized yet.
>
> Given that we're using the flag by default and setting it here,
> bio_alloc_clone should not inherit it. In fact we should probably
> figure out a way to remove it entirely, but if that is not possible
> it should only be set when the cache was actually used.
For now bio_alloc_clone will inherit all flag of source bio, IMO if only not
inherit REQ_ALLOC_CACHE, it's a little strange.
The REQ_ALLOC_CACHE flag can not remove entirely. maybe we can
modify like this:
if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
opf |= REQ_ALLOC_CACHE;
bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
gfp_mask, bs);
if (bio)
return bio;
/*
* No cached bio available, bio returned below marked with
* REQ_ALLOC_CACHE to participate in per-cpu alloc cache.
*/
} else
opf &= ~REQ_ALLOC_CACHE;
>
> > > > + /*
> > > > + * Even REQ_ALLOC_CACHE is enabled by default, we still need this to
> > > > + * mark bio is allocated by bio_alloc_bioset.
> > > > + */
> > > > if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) {
> > >
> > > I can't really parse the comment, can you explain what you mean?
> >
> > This is to tell others that REQ_ALLOC_CACHE can't be deleted here, and
> > that this flag
> > serves other purposes here.
>
> So what can't it be deleted?
blk_rq_map_bio_alloc use REQ_ALLOC_CACHE to tell whether to use
bio_alloc_bioset or bio_kmalloc, I considered removing the flag in
blk_rq_map_bio_alloc, but then there would have to be the introduction
of a new flag like REQ_xx. So I keep this and comment.
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [External] Re: [PATCH] block: enable per-cpu bio cache by default
2025-10-13 12:58 ` [External] " Fengnan Chang
@ 2025-10-13 13:31 ` Pavel Begunkov
2025-10-14 2:38 ` Fengnan Chang
0 siblings, 1 reply; 11+ messages in thread
From: Pavel Begunkov @ 2025-10-13 13:31 UTC (permalink / raw)
To: Fengnan Chang, Christoph Hellwig
Cc: fengnan chang, axboe, viro, brauner, jack, willy, djwong,
ritesh.list, linux-fsdevel, io-uring, linux-xfs, linux-ext4
On 10/13/25 13:58, Fengnan Chang wrote:
> Christoph Hellwig <hch@infradead.org> 于2025年10月13日周一 14:28写道:
>>
>> On Mon, Oct 13, 2025 at 01:42:47PM +0800, fengnan chang wrote:
>>>> Just set the req flag in the branch instead of unconditionally setting
>>>> it and then clearing it.
>>>
>>> clearing this flag is necessary, because bio_alloc_clone will call this in
>>> boot stage, maybe the bs->cache of the new bio is not initialized yet.
>>
>> Given that we're using the flag by default and setting it here,
>> bio_alloc_clone should not inherit it. In fact we should probably
>> figure out a way to remove it entirely, but if that is not possible
>> it should only be set when the cache was actually used.
>
> For now bio_alloc_clone will inherit all flag of source bio, IMO if only not
> inherit REQ_ALLOC_CACHE, it's a little strange.
> The REQ_ALLOC_CACHE flag can not remove entirely. maybe we can
> modify like this:
>
> if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
> opf |= REQ_ALLOC_CACHE;
> bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
> gfp_mask, bs);
> if (bio)
> return bio;
> /*
> * No cached bio available, bio returned below marked with
> * REQ_ALLOC_CACHE to participate in per-cpu alloc cache.
> */
> } else
> opf &= ~REQ_ALLOC_CACHE;
>
>>
>>>>> + /*
>>>>> + * Even REQ_ALLOC_CACHE is enabled by default, we still need this to
>>>>> + * mark bio is allocated by bio_alloc_bioset.
>>>>> + */
>>>>> if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) {
>>>>
>>>> I can't really parse the comment, can you explain what you mean?
>>>
>>> This is to tell others that REQ_ALLOC_CACHE can't be deleted here, and
>>> that this flag
>>> serves other purposes here.
>>
>> So what can't it be deleted?
>
> blk_rq_map_bio_alloc use REQ_ALLOC_CACHE to tell whether to use
> bio_alloc_bioset or bio_kmalloc, I considered removing the flag in
> blk_rq_map_bio_alloc, but then there would have to be the introduction
> of a new flag like REQ_xx. So I keep this and comment.
That can likely be made unconditional as well. Regardless of that,
it can't be removed without additional changes because it's used to
avoid de-allocating into the pcpu cache requests that wasn't
allocated for it. i.e.
if (bio->bi_opf & REQ_ALLOC_CACHE)
bio_put_percpu_cache(bio);
else
bio_free(bio);
Without it under memory pressure you can end up in a situation
where bios are put into pcpu caches of other CPUs and can't be
reallocated by the current CPU, effectively loosing the mempool
forward progress guarantees. See:
commit 759aa12f19155fe4e4fb4740450b4aa4233b7d9f
Author: Pavel Begunkov <asml.silence@gmail.com>
Date: Wed Nov 2 15:18:20 2022 +0000
bio: don't rob starving biosets of bios
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [External] Re: [PATCH] block: enable per-cpu bio cache by default
2025-10-13 13:31 ` Pavel Begunkov
@ 2025-10-14 2:38 ` Fengnan Chang
0 siblings, 0 replies; 11+ messages in thread
From: Fengnan Chang @ 2025-10-14 2:38 UTC (permalink / raw)
To: Pavel Begunkov
Cc: Christoph Hellwig, fengnan chang, axboe, viro, brauner, jack,
willy, djwong, ritesh.list, linux-fsdevel, io-uring, linux-xfs,
linux-ext4
Pavel Begunkov <asml.silence@gmail.com> 于2025年10月13日周一 21:30写道:
>
> On 10/13/25 13:58, Fengnan Chang wrote:
> > Christoph Hellwig <hch@infradead.org> 于2025年10月13日周一 14:28写道:
> >>
> >> On Mon, Oct 13, 2025 at 01:42:47PM +0800, fengnan chang wrote:
> >>>> Just set the req flag in the branch instead of unconditionally setting
> >>>> it and then clearing it.
> >>>
> >>> clearing this flag is necessary, because bio_alloc_clone will call this in
> >>> boot stage, maybe the bs->cache of the new bio is not initialized yet.
> >>
> >> Given that we're using the flag by default and setting it here,
> >> bio_alloc_clone should not inherit it. In fact we should probably
> >> figure out a way to remove it entirely, but if that is not possible
> >> it should only be set when the cache was actually used.
> >
> > For now bio_alloc_clone will inherit all flag of source bio, IMO if only not
> > inherit REQ_ALLOC_CACHE, it's a little strange.
> > The REQ_ALLOC_CACHE flag can not remove entirely. maybe we can
> > modify like this:
> >
> > if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
> > opf |= REQ_ALLOC_CACHE;
> > bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
> > gfp_mask, bs);
> > if (bio)
> > return bio;
> > /*
> > * No cached bio available, bio returned below marked with
> > * REQ_ALLOC_CACHE to participate in per-cpu alloc cache.
> > */
> > } else
> > opf &= ~REQ_ALLOC_CACHE;
> >
> >>
> >>>>> + /*
> >>>>> + * Even REQ_ALLOC_CACHE is enabled by default, we still need this to
> >>>>> + * mark bio is allocated by bio_alloc_bioset.
> >>>>> + */
> >>>>> if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) {
> >>>>
> >>>> I can't really parse the comment, can you explain what you mean?
> >>>
> >>> This is to tell others that REQ_ALLOC_CACHE can't be deleted here, and
> >>> that this flag
> >>> serves other purposes here.
> >>
> >> So what can't it be deleted?
> >
> > blk_rq_map_bio_alloc use REQ_ALLOC_CACHE to tell whether to use
> > bio_alloc_bioset or bio_kmalloc, I considered removing the flag in
> > blk_rq_map_bio_alloc, but then there would have to be the introduction
> > of a new flag like REQ_xx. So I keep this and comment.
>
> That can likely be made unconditional as well. Regardless of that,
Agree, IMO we can remove bio_kmalloc in blk_rq_map_bio_alloc, just
use bio_alloc_bioset. Do this in another patch maybe better ?
> it can't be removed without additional changes because it's used to
> avoid de-allocating into the pcpu cache requests that wasn't
> allocated for it. i.e.
>
> if (bio->bi_opf & REQ_ALLOC_CACHE)
> bio_put_percpu_cache(bio);
> else
> bio_free(bio);
>
> Without it under memory pressure you can end up in a situation
> where bios are put into pcpu caches of other CPUs and can't be
> reallocated by the current CPU, effectively loosing the mempool
> forward progress guarantees. See:
Thanks for your remind.
>
> commit 759aa12f19155fe4e4fb4740450b4aa4233b7d9f
> Author: Pavel Begunkov <asml.silence@gmail.com>
> Date: Wed Nov 2 15:18:20 2022 +0000
>
> bio: don't rob starving biosets of bios
>
> --
> Pavel Begunkov
>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-10-14 2:38 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-11 1:33 [PATCH] block: enable per-cpu bio cache by default Fengnan Chang
2025-10-11 1:36 ` fengnan chang
2025-10-11 1:43 ` fengnan chang
2025-10-13 3:24 ` Christoph Hellwig
2025-10-13 5:42 ` fengnan chang
2025-10-13 6:28 ` Christoph Hellwig
2025-10-13 12:58 ` [External] " Fengnan Chang
2025-10-13 13:31 ` Pavel Begunkov
2025-10-14 2:38 ` Fengnan Chang
2025-10-13 5:18 ` Ming Lei
2025-10-13 5:44 ` fengnan chang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).