virtio-blk: use blk_io_plug/unplug for Linux AIO batching
commitfc73548e444ae3239f6cef44a5200b5d2c3e85d1
authorStefan Hajnoczi <stefanha@redhat.com>
Mon, 20 Jul 2015 15:54:16 +0000 (20 16:54 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 12 Oct 2015 08:21:10 +0000 (12 09:21 +0100)
treeb403ecd4b4a52f4b10999d36fb78cddf5ff91a0a
parent5ec911c30ff4337d4185e29e82a254349f5a22da
virtio-blk: use blk_io_plug/unplug for Linux AIO batching

The raw-posix block driver implements Linux AIO batching so multiple
requests can be submitted with a single io_submit(2) system call.
Batching is currently only used by virtio-scsi and
virtio-blk-data-plane.

Enable batching for regular virtio-blk so the number of io_submit(2)
system calls is reduced for workloads with queue depth > 1.

In 4KB random read performance tests with queue depth 32, the CPU
utilization on the host is reduced by 9.4%.  The fio job is as follows:

  [global]
  bs=4k
  ioengine=libaio
  iodepth=32
  direct=1
  sync=0
  time_based=1
  runtime=30
  clocksource=gettimeofday
  ramp_time=5

  [job1]
  rw=randread
  filename=/dev/vdb
  size=4096M
  write_bw_log=fio
  write_iops_log=fio
  write_lat_log=fio
  log_avg_msec=1000

This benchmark was run on an raw image on LVM.  The disk was an SSD
drive and -drive cache=none,aio=native was used.

Tested-by: Pradeep Surisetty <psuriset@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
hw/block/virtio-blk.c