From patchwork Wed May 12 21:24:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 99109 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4CLRHbb029163 for ; Wed, 12 May 2010 21:27:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757954Ab0ELV1P (ORCPT ); Wed, 12 May 2010 17:27:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37922 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754166Ab0ELV1M (ORCPT ); Wed, 12 May 2010 17:27:12 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLR6od012620 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 May 2010 17:27:06 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLR5Mt020967; Wed, 12 May 2010 17:27:05 -0400 Received: from amt.cnet (vpn2-10-158.ams2.redhat.com [10.36.10.158]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLR34P021869; Wed, 12 May 2010 17:27:04 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id E84E8656076; Wed, 12 May 2010 18:25:39 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o4CLPUSI028642; Wed, 12 May 2010 18:25:30 -0300 From: Marcelo Tosatti To: Anthony Liguori Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Marcelo Tosatti , Avi Kivity Subject: [PATCH 01/12] Fix -mem-path with hugetlbfs Date: Wed, 12 May 2010 18:24:55 -0300 Message-Id: <618a568da4eda5c2e41fc4e58059546806afff6b.1273699506.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 12 May 2010 21:27:17 +0000 (UTC) diff --git a/exec.c b/exec.c index 3416aed..56b5561 100644 --- a/exec.c +++ b/exec.c @@ -2775,8 +2775,12 @@ ram_addr_t qemu_ram_alloc(ram_addr_t size) if (mem_path) { #if defined (__linux__) && !defined(TARGET_S390X) new_block->host = file_ram_alloc(size, mem_path); - if (!new_block->host) - exit(1); + if (!new_block->host) { + new_block->host = qemu_vmalloc(size); +#ifdef MADV_MERGEABLE + madvise(new_block->host, size, MADV_MERGEABLE); +#endif + } #else fprintf(stderr, "-mem-path option unsupported\n"); exit(1);