Avi Kivity wrote:
From: Izik Eidus <iei...@redhat.com>

Call madvise(MADV_MERGEABLE) on the memory allocations to allow the
kernel to merge them.

Signed-off-by: Izik Eidus <iei...@redhat.com>
Signed-off-by: Avi Kivity <a...@redhat.com>

Any reason to not send this to upstream qemu?

diff --git a/exec.c b/exec.c
index 5c9edf7..406d2cb 100644
--- a/exec.c
+++ b/exec.c
@@ -2538,6 +2538,9 @@ ram_addr_t qemu_ram_alloc(ram_addr_t size)
     new_block->host = file_ram_alloc(size, mem_path);
     if (!new_block->host) {
         new_block->host = qemu_vmalloc(size);
+#ifdef MADV_MERGEABLE
+        madvise(new_block->host, size, MADV_MERGEABLE);
+#endif
     }
     new_block->offset = last_ram_offset;
     new_block->length = size;
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Regards,

Anthony Liguori
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to