mirror_qemu/include
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
..
authz Include generated QAPI headers less 2019-08-16 13:31:51 +02:00
block util/async: make bh_aio_poll() O(1) 2020-02-22 08:26:47 +00:00
chardev chardev: Use QEMUChrEvent enum in IOEventHandler typedef 2020-01-08 11:15:35 +01:00
crypto crypto: Fix typo in QCryptoTLSSession's <example> comment 2019-12-18 08:36:15 +01:00
disas disas: Add a field for target-dependant data to disassemble_info 2020-01-29 19:28:52 +01:00
exec tcg: Add support for a helper with 7 arguments 2020-02-11 16:29:16 -08:00
fpu fpu: make softfloat-macros "self-contained" 2019-08-19 12:07:13 +01:00
hw arm: allwinner: Wire up USB ports 2020-02-21 16:07:02 +00:00
io io: Fix Error usage in a comment <example> 2019-12-18 08:36:15 +01:00
libdecnumber include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
migration migration: Support QLIST migration 2020-01-20 09:10:23 +01:00
monitor monitor: Move monitor option parsing to monitor/monitor.c 2020-02-17 13:47:48 +01:00
net Include qemu/queue.h slightly less 2019-08-16 13:31:52 +02:00
qapi qstring: add qstring_free() 2020-01-24 20:59:13 +01:00
qemu rcu_queue: add QSLIST functions 2020-02-22 08:26:47 +00:00
qom qom: introduce object_property_help() 2020-01-24 20:59:16 +01:00
scsi scsi: explicitly list guest-recoverable sense codes 2019-07-15 11:20:42 +02:00
standard-headers virtiofsd: Pull in kernel's fuse.h 2020-01-23 16:41:36 +00:00
sysemu monitor: Move monitor option parsing to monitor/monitor.c 2020-02-17 13:47:48 +01:00
tcg tcg: Add tcg_gen_gvec_5_ptr 2020-02-12 14:58:36 -08:00
ui display/gtk: get proper refreshrate 2020-01-14 07:26:36 +01:00
user linux-user: Include trace-root.h in syscall-trace.h 2020-01-15 15:13:09 -10:00
elf.h target/arm/arch_dump: Add SVE notes 2020-01-23 15:34:04 +00:00
glib-compat.h glib: bump min required glib library version to 2.48 2019-08-22 10:46:34 +01:00
qemu-common.h exec: Split out variable page size support to exec-vary.c 2019-10-28 10:26:02 +01:00
qemu-io.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
trace-tcg.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00