Stefan Hajnoczi 84d61e5f36 virtio: use defer_call() in virtio_irqfd_notify()
virtio-blk and virtio-scsi invoke virtio_irqfd_notify() to send Used
Buffer Notifications from an IOThread. This involves an eventfd
write(2) syscall. Calling this repeatedly when completing multiple I/O
requests in a row is wasteful.

Use the defer_call() API to batch together virtio_irqfd_notify() calls
made during thread pool (aio=threads), Linux AIO (aio=native), and
io_uring (aio=io_uring) completion processing.

Behavior is unchanged for emulated devices that do not use
defer_call_begin()/defer_call_end() since defer_call() immediately
invokes the callback when called outside a
defer_call_begin()/defer_call_end() region.

fio rw=randread bs=4k iodepth=64 numjobs=8 IOPS increases by ~9% with a
single IOThread and 8 vCPUs. iodepth=1 decreases by ~1% but this could
be noise. Detailed performance data and configuration specifics are
available here:
https://gitlab.com/stefanha/virt-playbooks/-/tree/blk_io_plug-irqfd

This duplicates the BH that virtio-blk uses for batching. The next
commit will remove it.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20230913200045.1024233-4-stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2023-10-31 15:42:14 +01:00
..
2023-05-30 17:37:26 +02:00
2023-03-20 12:43:50 +01:00
2023-08-31 19:47:43 +02:00
2023-05-23 15:20:15 +08:00
2020-01-06 18:41:32 +04:00
2023-03-20 12:43:50 +01:00
2023-09-07 20:32:11 -05:00
2022-04-21 17:03:51 +04:00
2023-08-31 19:47:43 +02:00
2019-09-11 08:46:17 +02:00
2023-04-24 11:29:00 +02:00
2020-12-10 17:16:44 +01:00
2023-08-31 19:47:43 +02:00
2022-06-29 10:56:12 +03:00
2023-10-17 15:20:53 +02:00
2023-08-31 19:47:43 +02:00
2023-02-02 11:48:20 +00:00
2023-03-28 15:23:10 -07:00
2023-08-31 19:47:43 +02:00
2023-04-27 16:39:43 +02:00
2023-10-04 18:15:06 -04:00
2021-04-01 15:27:44 +04:00