From ccb167e9d7d460a7cd09fdabd848efd3606dd27e Mon Sep 17 00:00:00 2001 From: Izik Eidus Date: Thu, 8 Oct 2009 16:39:39 +0200 Subject: [PATCH] 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 Signed-off-by: Anthony Liguori --- exec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exec.c b/exec.c index d9be5752c5..076d26b5ba 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; -- 2.11.4.GIT