From patchwork Mon May 3 21:12:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 96560 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 o43LDLVN009675 for ; Mon, 3 May 2010 21:13:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757153Ab0ECVM5 (ORCPT ); Mon, 3 May 2010 17:12:57 -0400 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 Date: Mon, 3 May 2010 18:12:23 -0300 From: Marcelo Tosatti To: kvm Subject: Fix -mem-path with hugetlbfs Message-ID: <20100503211223.GA18617@amt.cnet> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 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]); Mon, 03 May 2010 21:13:22 +0000 (UTC) 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);