aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorIzik Eidus <ieidus@redhat.com>2009-10-04 14:16:07 +0200
committerAvi Kivity <avi@redhat.com>2009-10-04 14:26:31 +0200
commit249cdd049c7976614ad46eb86409d5e1e53835cc (patch)
treed6cb259c91ab5f7af94d1b8c4bdb05e240ef555a /exec.c
parentMerge branch 'upstream-merge' (diff)
downloadqemu-kvm-249cdd049c7976614ad46eb86409d5e1e53835cc.tar.gz
qemu-kvm-249cdd049c7976614ad46eb86409d5e1e53835cc.tar.bz2
qemu-kvm-249cdd049c7976614ad46eb86409d5e1e53835cc.zip
ksm support
Call madvise(MADV_MERGEABLE) on the memory allocations to allow the kernel to merge them. Signed-off-by: Izik Eidus <ieidus@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index 5c9edf71f..406d2cbfa 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;