Skip to content

Add plug based request allocation batching

Jens Axboe io-uring linux-block 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 1 replyIn review
  2. v1 RFC3 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Remove hunk from another patch in patch 2
- Make the plugging limits block layer private

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3block: bump max plugged deferred size from 16 to 32block/blk-mq.c block/blk.h include/linux/blkdev.h+8 -41 reply
2/3block: pre-allocate requests if plug is started and is a batchblock/blk-core.c block/blk-mq.c block/blk-mq.h +2 more+109 -330 replies
3/3io_uring: inform block layer of how many requests we are submittingfs/io_uring.c+3 -10 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchChristoph Hellwig
1/3R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCHSET v2 0/3] Add plug based request allocation batching

Hi,

Even if the caller knows that N requests will be submitted, we still have to go all the way to tag allocation for each one. That's somewhat inefficient, when we could just grab as many tags as we need initially instead.

This small series allows request caching in the blk_plug. We add a new helper for passing in how many requests we expect to submit, blk_start_plug_nr_ios(), and then we can use that information to populate the cache on the first request allocation. Subsequent queue attempts can then just grab a pre-allocated request out of the cache rather than go into the tag allocation again.

This brings single core performance on my setup from:

taskset -c 0,16 t/io_uring -b512 -d128 -s32 -c32 -p1 -F1 -B1 -n2 /dev/nvme1n1 /dev/nvme2n1 Added file /dev/nvme1n1 (submitter 0)
Added file /dev/nvme2n1 (submitter 1)
polled=1, fixedbufs=1, register_files=1, buffered=0, QD=128
Engine=io_uring, sq_ring=128, cq_ring=256
submitter=0, tid=1206
submitter=1, tid=1207
IOPS=5806400, BW=2835MiB/s, IOS/call=32/32, inflight=(77 32)
IOPS=5860352, BW=2861MiB/s, IOS/call=32/31, inflight=(102 128)
IOPS=5844800, BW=2853MiB/s, IOS/call=32/32, inflight=(102 32)

to:

taskset -c 0,16 t/io_uring -b512 -d128 -s32 -c32 -p1 -F1 -B1 -n2 /dev/nvme1n1 /dev/nvme2n1 Added file /dev/nvme1n1 (submitter 0)
Added file /dev/nvme2n1 (submitter 1)
polled=1, fixedbufs=1, register_files=1, buffered=0, QD=128
Engine=io_uring, sq_ring=128, cq_ring=256
submitter=0, tid=1220
submitter=1, tid=1221
IOPS=6061248, BW=2959MiB/s, IOS/call=32/31, inflight=(114 82)
IOPS=6100672, BW=2978MiB/s, IOS/call=32/31, inflight=(128 128)
IOPS=6082496, BW=2969MiB/s, IOS/call=32/32, inflight=(77 38)

which is about a 4-5% improvement in single core performance. Looking at profiles, we're spending _less_ time in sbitmap even though we're doing more work.

V2:
- Remove hunk from another patch in patch 2
- Make the plugging limits block layer private

Signature · 1 line
Jens Axboe