• Suwan Kim's avatar
    virtio-blk: support mq_ops->queue_rqs() · 0e9911fa
    Suwan Kim authored
    This patch supports mq_ops->queue_rqs() hook. It has an advantage of
    batch submission to virtio-blk driver. It also helps polling I/O because
    polling uses batched completion of block layer. Batch submission in
    queue_rqs() can boost polling performance.
    
    In queue_rqs(), it iterates plug->mq_list, collects requests that
    belong to same HW queue until it encounters a request from other
    HW queue or sees the end of the list.
    Then, virtio-blk adds requests into virtqueue and kicks virtqueue
    to submit requests.
    
    If there is an error, it inserts error request to requeue_list and
    passes it to ordinary block layer path.
    
    For verification, I did fio test.
    (io_uring, randread, direct=1, bs=4K, iodepth=64 numjobs=N)
    I set 4 vcpu and 2 virtio-blk queues for VM and run fio test 5 times.
    It shows about 2% improvement.
    
                                     |   numjobs=2   |   numjobs=4
          -----------------------------------------------------------
            fio without queue_rqs()  |   291K IOPS   |   238K IOPS
          -----------------------------------------------------------
            fio with queue_rqs()     |   295K IOPS   |   243K IOPS
    
    For polling I/O performance, I also did fio test as below.
    (io_uring, hipri, randread, direct=1, bs=512, iodepth=64 numjobs=4)
    I set 4 vcpu and 2 poll queues for VM.
    It shows about 2% improvement in polling I/O.
    
                                          |   IOPS   |  avg latency
          -----------------------------------------------------------
            fio poll without queue_rqs()  |   424K   |   613.05 usec
          -----------------------------------------------------------
            fio poll with queue_rqs()     |   435K   |   601.01 usec
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarSuwan Kim <suwan.kim027@gmail.com>
    Message-Id: <20220406153207.163134-3-suwan.kim027@gmail.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
    0e9911fa
virtio_blk.c 30.5 KB