[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 23/32] memory: seek FlatView sharing candidates among
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 23/32] memory: seek FlatView sharing candidates among children subregions |
Date: |
Fri, 22 Sep 2017 01:16:31 +0200 |
A container can be used instead of an alias to allow switching between
multiple subregions. In this case we cannot directly share the
subregions (since they only belong to a single parent), but if the
subregions are aliases we can in turn walk those.
This is not enough to remove all source of quadratic FlatView creation,
but it enables sharing of the PCI bus master FlatViews (and their
AddressSpaceDispatch structures) across all PCI devices. For 112
virtio-net-pci devices, boot time is reduced from 25 to 10 seconds and
memory consumption from 1.4 to 1 G.
Signed-off-by: Paolo Bonzini <address@hidden>
---
memory.c | 40 ++++++++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/memory.c b/memory.c
index 68cdf8b..15b1bd7 100644
--- a/memory.c
+++ b/memory.c
@@ -734,12 +734,40 @@ static void render_memory_region(FlatView *view,
static MemoryRegion *memory_region_get_flatview_root(MemoryRegion *mr)
{
- while (mr->alias && !mr->alias_offset &&
- int128_ge(mr->size, mr->alias->size)) {
- /* The alias is included in its entirety. Use it as
- * the "real" root, so that we can share more FlatViews.
- */
- mr = mr->alias;
+ while (mr->enabled) {
+ if (mr->alias) {
+ if (!mr->alias_offset && int128_ge(mr->size, mr->alias->size)) {
+ /* The alias is included in its entirety. Use it as
+ * the "real" root, so that we can share more FlatViews.
+ */
+ mr = mr->alias;
+ continue;
+ }
+ } else if (!mr->terminates) {
+ unsigned int found = 0;
+ MemoryRegion *child, *next = NULL;
+ QTAILQ_FOREACH(child, &mr->subregions, subregions_link) {
+ if (child->enabled) {
+ if (++found > 1) {
+ next = NULL;
+ break;
+ }
+ if (!child->addr && int128_ge(mr->size, child->size)) {
+ /* A child is included in its entirety. If it's the
only
+ * enabled one, use it in the hope of finding an alias
down the
+ * way. This will also let us share FlatViews.
+ */
+ next = child;
+ }
+ }
+ }
+ if (next) {
+ mr = next;
+ continue;
+ }
+ }
+
+ break;
}
return mr;
--
1.8.3.1
- [Qemu-devel] [PULL 09/32] memory: Move AddressSpaceDispatch from AddressSpace to FlatView, (continued)
- [Qemu-devel] [PULL 09/32] memory: Move AddressSpaceDispatch from AddressSpace to FlatView, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 13/32] memory: Rename mem_begin/mem_commit/mem_add helpers, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 12/32] memory: Cleanup after switching to FlatView, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 14/32] memory: Store physical root MR in FlatView, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 15/32] memory: Alloc dispatch tree where topology is generared, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 11/32] memory: Switch memory from using AddressSpace to FlatView, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 16/32] memory: Move address_space_update_ioeventfds, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 17/32] memory: Share FlatView's and dispatch trees between address spaces, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 18/32] memory: Do not allocate FlatView in address_space_init, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 21/32] memory: Create FlatView directly, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 23/32] memory: seek FlatView sharing candidates among children subregions,
Paolo Bonzini <=
- [Qemu-devel] [PULL 20/32] memory: Get rid of address_space_init_shareable, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 22/32] memory: trace FlatView creation and destruction, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 19/32] memory: Rework "info mtree" to print flat views and dispatch trees, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 24/32] memory: Share special empty FlatView, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 25/32] scsi, file-posix: add support for persistent reservation management, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 29/32] chardev: new qemu_chr_be_update_read_handlers(), Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 28/32] scsi: add persistent reservation manager using qemu-pr-helper, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 30/32] chardev: add Chardev.gcontext field, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 27/32] scsi: add multipath support to qemu-pr-helper, Paolo Bonzini, 2017/09/21
- [Qemu-devel] [PULL 26/32] scsi: build qemu-pr-helper, Paolo Bonzini, 2017/09/21