qemu-patch-raspberry4/include/block
Stefan Hajnoczi 8c6b0356b5 util/async: make bh_aio_poll() O(1)
The ctx->first_bh list contains all created BHs, including those that
are not scheduled.  The list is iterated by the event loop and therefore
has O(n) time complexity with respected to the number of created BHs.

Rewrite BHs so that only scheduled or deleted BHs are enqueued.
Only BHs that actually require action will be iterated.

One semantic change is required: qemu_bh_delete() enqueues the BH and
therefore invokes aio_notify().  The
tests/test-aio.c:test_source_bh_delete_from_cb() test case assumed that
g_main_context_iteration(NULL, false) returns false after
qemu_bh_delete() but it now returns true for one iteration.  Fix up the
test case.

This patch makes aio_compute_timeout() and aio_bh_poll() drop from a CPU
profile reported by perf-top(1).  Previously they combined to 9% CPU
utilization when AioContext polling is commented out and the guest has 2
virtio-blk,num-queues=1 and 99 virtio-blk,num-queues=32 devices.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20200221093951.1414693-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-02-22 08:26:47 +00:00
..
accounting.h block: add empty account cookie type 2019-10-10 10:56:18 +02:00
aio-wait.h Clean up decorations and whitespace around header guards 2019-05-13 08:58:55 +02:00
aio.h util/async: make bh_aio_poll() O(1) 2020-02-22 08:26:47 +00:00
aio_task.h block: introduce aio task pool 2019-10-10 10:56:17 +02:00
block-copy.h block/block-copy: increase buffered copy request 2019-10-28 11:22:31 +01:00
block.h qapi: Allow getting flat output from 'query-named-block-nodes' 2020-02-20 16:43:42 +01:00
block_backup.h block/backup: drop unused synchronization interface 2018-12-14 11:52:40 +01:00
block_int.h block: Remove bdrv_recurse_is_first_non_filter() 2020-02-18 11:55:40 +01:00
blockjob.h blockdev: blockdev_mark_auto_del: drop usage of bs->job 2019-06-18 16:41:10 +02:00
blockjob_int.h job: drop job_drain 2019-09-10 08:58:43 +02:00
dirty-bitmap.h bitmap: Enforce maximum bitmap name length 2019-11-18 16:01:34 -06:00
nbd.h nbd: Don't send oversize strings 2019-11-18 16:01:34 -06:00
nvme.h nvme: fix NSSRS offset in CAP register 2019-11-04 09:21:45 +01:00
qapi.h qapi: Allow getting flat output from 'query-named-block-nodes' 2020-02-20 16:43:42 +01:00
qdict.h block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
raw-aio.h block/io_uring: implements interfaces for io_uring 2020-01-30 20:59:41 +00:00
snapshot.h block/snapshot: rename Error ** parameter to more common errp 2019-12-18 08:43:19 +01:00
thread-pool.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
throttle-groups.h throttle-groups: fix restart coroutine iothread race 2019-01-24 10:02:28 +00:00
write-threshold.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00