Skip to content

Initial support for polled IO

Jens Axboe lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5block: change ->make_request_fn() and users to return a queue cookiearch/m68k/emu/nfblock.c arch/powerpc/sysdev/axonram.c arch/xtensa/platforms/iss/simdisk.c +25 more+127 -710 replies
2/5blk-mq: return tag/queue combo in the make_request_fn handlersblock/blk-mq.c+28 -170 replies
3/5block: add block polling supportblock/blk-core.c block/blk-mq-sysfs.c block/blk-sysfs.c +2 more+99 -00 replies
4/5NVMe: add blk polling supportdrivers/nvme/host/pci.c+28 -43 replies
5/5directio: add block polling supportfs/direct-io.c+10 -40 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchKeith BuschChristoph Hellwig
SeriesA-b A-b
1/5
2/5
3/5
4/5
5/5

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

Read the v1 thread

Cover letter [PATCH 0/5] Initial support for polled IO

Hi,

This is a basic framework for supporting polled IO with the block layer stack, and added support for sync O_DIRECT IO and the NVMe driver.

There are a few things missing to truly productize this, but it's very useful for testing. For now, it's a per-device opt-in feature. To enable it, you echo 1 to /sys/block/<dev>/queue/io_poll.

Some basic test results:

# dd if=/dev/nvme2n1 of=/dev/null bs=4096 iflag=direct count=200k
[...]
838860800 bytes (839 MB) copied, 3.98791 s, 210 MB/s
# echo 1 > /sys/block/nvme2n1/queue/io_poll
# dd if=/dev/nvme2n1 of=/dev/null bs=4096 iflag=direct count=200k
[...]
838860800 bytes (839 MB) copied, 2.15479 s, 389 MB/s

This is a DRAM backed NVMe device, per IO latencies drop from ~19.5usec to ~10.5usec.

# dd if=/dev/nvme0n1 of=/dev/null bs=4096 iflag=direct count=200k
[...]
838860800 bytes (839 MB) copied, 5.90349 s, 142 MB/s
# echo 1 > /sys/block/nvme0n1/queue/io_poll
# dd if=/dev/nvme0n1 of=/dev/null bs=4096 iflag=direct count=200k
838860800 bytes (839 MB) copied, 3.15852 s, 266 MB/s

Samsung NVMe device, ~28.8 -> ~15.4 usec

# dd if=/dev/nvme1n1 of=/dev/null bs=4096 iflag=direct count=200k
[...]
838860800 bytes (839 MB) copied, 1.78069 s, 471 MB/s
# echo 1 > /sys/block/nvme1n1/queue/io_poll 
# dd if=/dev/nvme1n1 of=/dev/null bs=4096 iflag=direct count=200k
[...]
838860800 bytes (839 MB) copied, 1.31546 s, 638 MB/s

Intel NVMe device, ~8.7usec -> ~6.4usec.

Three different devices, different but notable wins on all of them. Contrary to intuition, sometimes the slower devices benefit more, since the slower completion yields a deeper C-state on the processor.

I'd like to get this framework in so we can more easily experiment with polling. I've got another branch, mq-stats, that wires up a scalable device IO completion stats collection. We could potentially use that for enabling smart decisions about when to poll and for how long. We'll also work on enabling libaio support for this.

Thanks, Jens