• Marc Zyngier's avatar
    KVM: Convert the kvm->vcpus array to a xarray · c5b07754
    Marc Zyngier authored
    At least on arm64 and x86, the vcpus array is pretty huge (up to
    1024 entries on x86) and is mostly empty in the majority of the cases
    (running 1k vcpu VMs is not that common).
    
    This mean that we end-up with a 4kB block of unused memory in the
    middle of the kvm structure.
    
    Instead of wasting away this memory, let's use an xarray instead,
    which gives us almost the same flexibility as a normal array, but
    with a reduced memory usage with smaller VMs.
    Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
    Message-Id: <20211116160403.4074052-6-maz@kernel.org>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    c5b07754
kvm_main.c 139 KB