From patchwork Mon Aug 1 19:26:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: xen: Avoid useless allocation in Xen case. Date: Mon, 01 Aug 2011 09:26:21 -0000 From: Anthony PERARD X-Patchwork-Id: 107795 Message-Id: <1312226782-26882-1-git-send-email-anthony.perard@citrix.com> To: QEMU-devel Cc: Anthony PERARD , Xen Devel , Alexander Graf , Stefano Stabellini The code_gen_buffer is not use by Xen and can be really big (several GB). Even if the host RAM is not used, this buffer just burn the address space of the QEMU process. So to "avoid" this allocation, the asked tb_size is set to the minimum. The other way to do that would be to not call code_gen_alloc when Xen is enabled. Signed-off-by: Anthony PERARD --- vl.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/vl.c b/vl.c index d8c7c01..bd60a89 100644 --- a/vl.c +++ b/vl.c @@ -3106,6 +3106,14 @@ int main(int argc, char **argv, char **envp) } } + if (xen_enabled()) { + /* Allocate only the minimum amount of memory for the code_gen_buffer. + * Xen does not use it and we need the virtual address space for the + * MapCache. + */ + tb_size = 1; + } + /* init the dynamic translator */ cpu_exec_init_all(tb_size * 1024 * 1024);