From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Fix -mem-path with hugetlbfs Date: Mon, 3 May 2010 18:12:23 -0300 Message-ID: <20100503211223.GA18617@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: kvm Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50149 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756907Ab0ECVM5 (ORCPT ); Mon, 3 May 2010 17:12:57 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o43LCuro018376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 3 May 2010 17:12:56 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o43LCucq028595 for ; Mon, 3 May 2010 17:12:56 -0400 Received: from amt.cnet (vpn-11-168.rdu.redhat.com [10.11.11.168]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o43LCqig029187 for ; Mon, 3 May 2010 17:12:55 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id B472A656076 for ; Mon, 3 May 2010 18:12:24 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o43LCOHe018721 for kvm@vger.kernel.org; Mon, 3 May 2010 18:12:24 -0300 Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: Avi, please apply to both master and uq/master. --- Fallback to qemu_vmalloc in case file_ram_alloc fails. Signed-off-by: Marcelo Tosatti diff --git a/exec.c b/exec.c index 467a0e7..7125a93 100644 --- a/exec.c +++ b/exec.c @@ -2821,8 +2821,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);