diff mbox

[7/9] kvm tools: Advise memory allocated for guest RAM as KSM mergable

Message ID 1309370538-7947-7-git-send-email-levinsasha928@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sasha Levin June 29, 2011, 6:02 p.m. UTC
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/kvm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
index 4f723a6..15bcf08 100644
--- a/tools/kvm/kvm.c
+++ b/tools/kvm/kvm.c
@@ -345,6 +345,8 @@  struct kvm *kvm__init(const char *kvm_dev, u64 ram_size, const char *name)
 	if (kvm->ram_start == MAP_FAILED)
 		die("out of memory");
 
+	madvise(kvm->ram_start, kvm->ram_size, MADV_MERGEABLE);
+
 	ret = ioctl(kvm->vm_fd, KVM_CREATE_IRQCHIP);
 	if (ret < 0)
 		die_perror("KVM_CREATE_IRQCHIP ioctl");