mirror of https://github.com/proxmox/mirror_qemu
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>master
parent
54d7cf136f
commit
618a568da4
8
exec.c
8
exec.c
|
@ -2775,8 +2775,12 @@ ram_addr_t qemu_ram_alloc(ram_addr_t size)
|
||||||
if (mem_path) {
|
if (mem_path) {
|
||||||
#if defined (__linux__) && !defined(TARGET_S390X)
|
#if defined (__linux__) && !defined(TARGET_S390X)
|
||||||
new_block->host = file_ram_alloc(size, mem_path);
|
new_block->host = file_ram_alloc(size, mem_path);
|
||||||
if (!new_block->host)
|
if (!new_block->host) {
|
||||||
exit(1);
|
new_block->host = qemu_vmalloc(size);
|
||||||
|
#ifdef MADV_MERGEABLE
|
||||||
|
madvise(new_block->host, size, MADV_MERGEABLE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "-mem-path option unsupported\n");
|
fprintf(stderr, "-mem-path option unsupported\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
Loading…
Reference in New Issue