]> git.proxmox.com Git - mirror_qemu.git/commit
memory: batch allocate ioeventfds[] in address_space_update_ioeventfds()
authorStefan Hajnoczi <stefanha@redhat.com>
Tue, 18 Feb 2020 18:22:26 +0000 (18:22 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 25 Feb 2020 08:18:01 +0000 (09:18 +0100)
commit920d557e5ae58671d335acbcfba3f9a97a02911c
treec6fbdce4ebcffb29ae5f92322b2e82ebc7216a09
parentc1e667d2598b9b3ce62b8e89ed22dd38dfe9f57f
memory: batch allocate ioeventfds[] in address_space_update_ioeventfds()

Reallocing the ioeventfds[] array each time an element is added is very
expensive as the number of ioeventfds increases.  Batch allocate instead
to amortize the cost of realloc.

This patch reduces Linux guest boot times from 362s to 140s when there
are 2 virtio-blk devices with 1 virtqueue and 99 virtio-blk devices with
32 virtqueues.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200218182226.913977-1-stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
memory.c