OSDN Git Service

kvm: use insert sort in kvm_io_bus_register_dev function
authorGal Hammer <ghammer@redhat.com>
Tue, 16 Jan 2018 13:34:41 +0000 (15:34 +0200)
committerRadim Krčmář <rkrcmar@redhat.com>
Tue, 6 Mar 2018 17:40:44 +0000 (18:40 +0100)
commitd4c67a7a54f12cb8d267284212f1072c95917e5a
treebdd2a438fbbb884a45a6fb0ec82f1e9404516c4c
parent01643c51bfcf2460b530854046f62ce1b29713ab
kvm: use insert sort in kvm_io_bus_register_dev function

The loading time of a VM is quite significant with a CPU usage
reaching 100% when loading a VM that its virtio devices use a
large amount of virt-queues (e.g. a virtio-serial device with
max_ports=511). Most of the time is spend in re-sorting the
kvm_io_bus kvm_io_range array when a new eventfd is registered.

The patch replaces the existing method with an insert sort.

Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Uri Lublin <ulublin@redhat.com>
Signed-off-by: Gal Hammer <ghammer@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
virt/kvm/kvm_main.c