From: Anthony Xu <anthony.xu@intel.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, Anthony Xu <anthony.xu@intel.com>
Subject: [Qemu-devel] [PATCH] Memory: use memory address space for cpu-memory
Date: Tue, 16 May 2017 15:15:23 -0700 [thread overview]
Message-ID: <1494972923-31756-1-git-send-email-anthony.xu@intel.com> (raw)
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
next reply other threads:[~2017-05-16 22:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 22:15 Anthony Xu [this message]
2017-05-17 9:27 ` [Qemu-devel] [PATCH] Memory: use memory address space for cpu-memory 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1494972923-31756-1-git-send-email-anthony.xu@intel.com \
--to=anthony.xu@intel.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).