aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2010-05-03 18:12:23 -0300
committerMarcelo Tosatti <mtosatti@redhat.com>2010-05-11 14:02:21 -0300
commit618a568da4eda5c2e41fc4e58059546806afff6b (patch)
tree3614d97071e0cbfa97bcad2f5f25082e10fb93a8 /exec.c
parent54d7cf136f040713095cbc064f62d753bff6f9d2 (diff)
downloadqemu-618a568da4eda5c2e41fc4e58059546806afff6b.zip
qemu-618a568da4eda5c2e41fc4e58059546806afff6b.tar.gz
qemu-618a568da4eda5c2e41fc4e58059546806afff6b.tar.bz2
Fix -mem-path with hugetlbfs
Fallback to qemu_vmalloc in case file_ram_alloc fails. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c8
1 files changed, 6 insertions, 2 deletions
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);