qemu/include/block
Stefan Hajnoczi fa9185fcdf block: change reqs_lock to QemuMutex
CoMutex has poor performance when lock contention is high. The tracked
requests list is accessed frequently and performance suffers in QEMU
multi-queue block layer scenarios.

It is not necessary to use CoMutex for the requests lock. The lock is
always released across coroutine yield operations. It is held for
relatively short periods of time and it is not beneficial to yield when
the lock is held by another coroutine.

Change the lock type from CoMutex to QemuMutex to improve multi-queue
block layer performance. fio randread bs=4k iodepth=64 with 4 IOThreads
handling a virtio-blk device with 8 virtqueues improves from 254k to
517k IOPS (+203%). Full benchmark results and configuration details are
available here:
980c40845d

In the future we may wish to introduce thread-local tracked requests
lists to avoid lock contention completely. That would be much more
involved though.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20230808155852.2745350-3-stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2023-09-08 17:03:09 +02:00
..
accounting.h block: add accounting for zone append operation 2023-05-15 08:18:10 -04:00
aio-wait.h aio-wait: avoid AioContext lock in aio_wait_bh_oneshot() 2023-05-10 14:15:13 +02:00
aio.h aio: remove aio_disable_external() API 2023-05-30 17:37:26 +02:00
aio_task.h coroutine: Move coroutine_fn to qemu/osdep.h, trim includes 2023-01-19 10:18:28 +01:00
block-common.h block: add subcluster_size field to BlockDriverInfo 2023-08-30 07:39:10 -04:00
block-copy.h block: Mark bdrv_co_block_status() and callers GRAPH_RDLOCK 2023-02-23 19:49:07 +01:00
block-global-state.h block: Call .bdrv_co_create(_opts) unlocked 2023-05-19 19:12:12 +02:00
block-hmp-cmds.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
block-io.h block/io: align requests to subcluster_size 2023-08-30 07:39:10 -04:00
block.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
block_backup.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
block_int-common.h block: change reqs_lock to QemuMutex 2023-09-08 17:03:09 +02:00
block_int-global-state.h block: Mark bdrv_recurse_can_replace() and callers GRAPH_RDLOCK 2023-05-10 14:16:54 +02:00
block_int-io.h block: Mark bdrv_co_refresh_total_sectors() and callers GRAPH_RDLOCK 2023-02-23 19:49:33 +01:00
block_int.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
blockjob.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
blockjob_int.h blockjob: Adhere to rate limit even when reentered early 2023-05-19 19:12:12 +02:00
dirty-bitmap.h block: Mark bdrv_*_dirty_bitmap() and callers GRAPH_RDLOCK 2023-02-23 19:49:32 +01:00
export.h block/export: don't require AioContext lock around blk_exp_ref/unref() 2023-05-30 17:32:02 +02:00
fuse.h fuse: Allow exporting BDSs via FUSE 2020-12-11 17:52:39 +01:00
graph-lock.h graph-lock: Unlock the AioContext while polling 2023-06-28 08:46:23 +02:00
nbd.h nbd: Use enum for various negotiation modes 2023-07-19 15:26:13 -05:00
nvme.h hw/nvme: flexible data placement emulation 2023-03-06 15:28:02 +01:00
qapi.h block: Mark bdrv_query_block_graph_info() and callers GRAPH_RDLOCK 2023-05-10 14:16:54 +02:00
qdict.h include: move qdict_{crumple,flatten} declarations 2022-04-21 17:03:51 +04:00
raw-aio.h block/linux-aio: convert to blk_io_plug_call() API 2023-06-01 07:34:03 -04:00
replication.h replication: move include out of root directory 2021-05-26 14:49:46 +02:00
reqlist.h block/reqlist: add reqlist_wait_all() 2022-03-07 09:33:30 +01:00
snapshot.h include/block/snapshot: global state API + assertions 2022-03-04 18:18:25 +01:00
thread-pool.h thread-pool: avoid passing the pool parameter every time 2023-04-25 13:17:28 +02:00
throttle-groups.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
write-threshold.h block: Clean up includes 2023-02-08 07:28:05 +01:00