Received: from eggs.gnu.org ([2001:4830:134:3::10]:36709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4Wcr-00047B-Bu for qemu-devel@nongnu.org; Wed, 31 Jul 2013 09:39:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4WBS-0006Tf-GQ for qemu-devel@nongnu.org; Wed, 31 Jul 2013 09:11:30 -0400 Received: from oxygen.pond.sub.org ([2a01:4f8:121:10e4::3]:60882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4WBS-0006SW-7J for qemu-devel@nongnu.org; Wed, 31 Jul 2013 09:11:18 -0400 From: Markus Armbruster Date: Wed, 31 Jul 2013 15:11:06 +0200 Message-Id: <1375276272-15988-3-git-send-email-armbru@redhat.com> In-Reply-To: <1375276272-15988-1-git-send-email-armbru@redhat.com> References: <1375276272-15988-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v3 for 1.6 2/8] exec: Clean up fall back when -mem-path allocation fails List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, stefano.stabellini@eu.citrix.com, mtosatti@redhat.com, agraf@suse.de, borntraeger@de.ibm.com, mkletzan@redhat.com, pbonzini@redhat.com, afaerber@suse.de, rth@twiddle.net With -mem-path, qemu_ram_alloc_from_ptr() first tries to allocate accordingly, but when it fails, it falls back to normal allocation. The fall back allocation code used to be effectively identical to the "-mem-path not given" code, until it started to diverge in commit 432d268. I believe the code still works, but clean it up anyway: drop the special fall back allocation code, and fall back to the ordinary "-mem-path not given" code instead. Reviewed-by: Paolo Bonzini Signed-off-by: Markus Armbruster --- exec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/exec.c b/exec.c index 5b1be92..957266c 100644 --- a/exec.c +++ b/exec.c @@ -1129,15 +1129,12 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, if (mem_path) { #if defined (__linux__) && !defined(TARGET_S390X) new_block->host = file_ram_alloc(new_block, size, mem_path); - if (!new_block->host) { - new_block->host = qemu_anon_ram_alloc(size); - memory_try_enable_merging(new_block->host, size); - } #else fprintf(stderr, "-mem-path option unsupported\n"); exit(1); #endif - } else { + } + if (!new_block->host) { if (kvm_enabled()) { /* some s390/kvm configurations have special constraints */ new_block->host = kvm_ram_alloc(size); -- 1.7.11.7