From patchwork Mon Aug 1 19:26:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 107795 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 34691B7091 for ; Tue, 2 Aug 2011 05:26:58 +1000 (EST) Received: from localhost ([::1]:52697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qny8d-0007Al-54 for incoming@patchwork.ozlabs.org; Mon, 01 Aug 2011 15:26:55 -0400 Received: from eggs.gnu.org ([140.186.70.92]:34289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qny8W-00079x-CN for qemu-devel@nongnu.org; Mon, 01 Aug 2011 15:26:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qny8T-0007qz-VF for qemu-devel@nongnu.org; Mon, 01 Aug 2011 15:26:48 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:22399) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qny8T-0007qm-RZ for qemu-devel@nongnu.org; Mon, 01 Aug 2011 15:26:45 -0400 X-IronPort-AV: E=Sophos;i="4.67,301,1309752000"; d="scan'208";a="157374472" Received: from ftlpmailmx01.citrite.net ([10.13.107.65]) by FTLPIPO02.CITRIX.COM with ESMTP/TLS/RC4-MD5; 01 Aug 2011 15:26:29 -0400 Received: from smtp01.ad.xensource.com (10.219.128.104) by smtprelay.citrix.com (10.13.107.65) with Microsoft SMTP Server id 8.3.137.0; Mon, 1 Aug 2011 15:26:28 -0400 Received: from perard.uk.xensource.com (dhcp-3-28.uk.xensource.com [10.80.3.28] (may be forged)) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id p71JQQe9029854; Mon, 1 Aug 2011 12:26:26 -0700 From: Anthony PERARD To: QEMU-devel Date: Mon, 1 Aug 2011 20:26:21 +0100 Message-ID: <1312226782-26882-1-git-send-email-anthony.perard@citrix.com> X-Mailer: git-send-email 1.7.2.5 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Cc: Anthony PERARD , Xen Devel , Alexander Graf , Stefano Stabellini Subject: [Qemu-devel] [PATCH] xen: Avoid useless allocation in Xen case. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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);