aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorIzik Eidus <ieidus@redhat.com>2009-10-08 16:39:39 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-15 09:32:04 -0500
commitccb167e9d7d460a7cd09fdabd848efd3606dd27e (patch)
tree5c3616480df6ef301774cd4294f5dfc14a490992 /exec.c
parentde41ac924bb2cf7cb8aaaa8c7f95a38c6d9b3783 (diff)
downloadqemu-ccb167e9d7d460a7cd09fdabd848efd3606dd27e.zip
qemu-ccb167e9d7d460a7cd09fdabd848efd3606dd27e.tar.gz
qemu-ccb167e9d7d460a7cd09fdabd848efd3606dd27e.tar.bz2
ksm support
Call MADV_MERGEABLE on guest memory allocations. MADV_MERGABLE will be available starting in Linux 2.6.32. This system call registers a region of virtual address space with Linux as a candidate for transparent memory sharing. Patchworks-ID: 35447 Signed-off-by: Izik Eidus <ieidus@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.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 d9be575..076d26b 100644
--- a/exec.c
+++ b/exec.c
@@ -2412,6 +2412,9 @@ ram_addr_t qemu_ram_alloc(ram_addr_t size)
new_block = qemu_malloc(sizeof(*new_block));
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;