qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Memory: use memory address space for cpu-memory
@ 2017-05-16 22:15 Anthony Xu
  2017-05-17  9:27 ` Igor Mammedov
  0 siblings, 1 reply; 8+ messages in thread
From: Anthony Xu @ 2017-05-16 22:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Anthony Xu

If cpu-memory address space is same as memory address space,
use memory address space for cpu-memory address space.

any memory region change causeaddress space to rebuild PhysPageMap,
rebuilding PhysPageMap is very expensive.

removing cpu-memory address space reduces the guest boot time and
memory usage.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
---
 cpus.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/cpus.c b/cpus.c
index 740b8dc..15c7a6a 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1748,8 +1748,13 @@ void qemu_init_vcpu(CPUState *cpu)
         /* If the target cpu hasn't set up any address spaces itself,
          * give it the default one.
          */
-        AddressSpace *as = address_space_init_shareable(cpu->memory,
-                                                        "cpu-memory");
+        AddressSpace *as;
+        if (cpu->memory == address_space_memory.root) {
+            address_space_memory.ref_count++;
+            as = &address_space_memory;
+        } else {
+            as = address_space_init_shareable(cpu->memory, "cpu-memory");
+        }
         cpu->num_ases = 1;
         cpu_address_space_init(cpu, as, 0);
     }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-05-19  9:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-16 22:15 [Qemu-devel] [PATCH] Memory: use memory address space for cpu-memory Anthony Xu
2017-05-17  9:27 ` Igor Mammedov
2017-05-17 17:01   ` Xu, Anthony
2017-05-18 21:38     ` Paolo Bonzini
2017-05-18 21:48       ` Xu, Anthony
2017-05-18 21:49         ` Paolo Bonzini
2017-05-18 23:28           ` Xu, Anthony
2017-05-19  9:30             ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).