提交 618a568d 编写于 作者: M Marcelo Tosatti

Fix -mem-path with hugetlbfs

Fallback to qemu_vmalloc in case file_ram_alloc fails.
Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 54d7cf13
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册