@@ -469,6 +469,7 @@ extern ram_addr_t ram_size;
/* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */
#define RAM_PREALLOC_MASK (1 << 0)
+#define RAM_MERGEABLE (1 << 1)
typedef struct RAMBlock {
struct MemoryRegion *mr;
@@ -2535,6 +2535,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
new_block->host = file_ram_alloc(new_block, size, mem_path);
if (!new_block->host) {
new_block->host = qemu_vmalloc(size);
+ new_block->flags |= RAM_MERGEABLE;
madvise_mergeable(new_block->host, size);
}
#else
@@ -2562,6 +2563,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
new_block->host = qemu_vmalloc(size);
}
#endif
+ new_block->flags |= RAM_MERGEABLE;
madvise_mergeable(new_block->host, size);
}
}
@@ -2689,6 +2691,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
length, addr);
exit(1);
}
+ block->flags |= RAM_MERGEABLE;
madvise_mergeable(vaddr, length);
}
return;
Will be used by the next commit. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- cpu-all.h | 1 + exec.c | 3 +++ 2 files changed, 4 insertions(+)