Commit c5b0775
KVM: Convert the kvm->vcpus array to a xarray
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: Marc Zyngier <maz@kernel.org>
Message-Id: <20211116160403.4074052-6-maz@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>1 parent 113d10b commit c5b0775
2 files changed
+12
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
552 | 553 | | |
553 | 554 | | |
554 | 555 | | |
555 | | - | |
| 556 | + | |
556 | 557 | | |
557 | 558 | | |
558 | 559 | | |
| |||
701 | 702 | | |
702 | 703 | | |
703 | 704 | | |
704 | | - | |
| 705 | + | |
705 | 706 | | |
706 | 707 | | |
707 | 708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
| 461 | + | |
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| |||
1063 | 1063 | | |
1064 | 1064 | | |
1065 | 1065 | | |
| 1066 | + | |
1066 | 1067 | | |
1067 | 1068 | | |
1068 | 1069 | | |
| |||
3598 | 3599 | | |
3599 | 3600 | | |
3600 | 3601 | | |
3601 | | - | |
| 3602 | + | |
| 3603 | + | |
| 3604 | + | |
| 3605 | + | |
3602 | 3606 | | |
3603 | 3607 | | |
3604 | 3608 | | |
| |||
3608 | 3612 | | |
3609 | 3613 | | |
3610 | 3614 | | |
| 3615 | + | |
3611 | 3616 | | |
3612 | 3617 | | |
3613 | 3618 | | |
3614 | 3619 | | |
3615 | | - | |
3616 | | - | |
3617 | 3620 | | |
3618 | | - | |
3619 | | - | |
| 3621 | + | |
| 3622 | + | |
3620 | 3623 | | |
3621 | 3624 | | |
3622 | 3625 | | |
| |||
0 commit comments