kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm tools: Make the whole guest memory mergeable
@ 2011-12-16  1:01 zanghongyong
  2011-12-16  5:50 ` Sasha Levin
  0 siblings, 1 reply; 9+ messages in thread
From: zanghongyong @ 2011-12-16  1:01 UTC (permalink / raw)
  To: kvm
  Cc: penberg, levinsasha928, xiaowei.yang, hanweidong, wusongwei,
	kongbo, Hongyong Zang

From: Hongyong Zang <zanghongyong@huawei.com>

If a guest's ram_size exceeds KVM_32BIT_GAP_START, the corresponding kvm tool's
virtual address size should be (ram_size + KVM_32BIT_GAP_SIZE), rather than ram_size.

Signed-off-by: Hongyong Zang <zanghongyong@huawei.com>
---
 tools/kvm/x86/kvm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/kvm/x86/kvm.c b/tools/kvm/x86/kvm.c
index bc52ef3..6107a2c 100644
--- a/tools/kvm/x86/kvm.c
+++ b/tools/kvm/x86/kvm.c
@@ -175,7 +175,9 @@ void kvm__arch_init(struct kvm *kvm, const char *kvm_dev, const char *hugetlbfs_
 	if (kvm->ram_start == MAP_FAILED)
 		die("out of memory");
 
-	madvise(kvm->ram_start, kvm->ram_size, MADV_MERGEABLE);
+	madvise(kvm->ram_start, 
+		(ram_size < KVM_32BIT_GAP_START) ? ram_size : (ram_size + KVM_32BIT_GAP_SIZE), 
+		MADV_MERGEABLE);
 
 	ret = ioctl(kvm->vm_fd, KVM_CREATE_IRQCHIP);
 	if (ret < 0)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-12-19  2:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16  1:01 [PATCH] kvm tools: Make the whole guest memory mergeable zanghongyong
2011-12-16  5:50 ` Sasha Levin
2011-12-16  7:02   ` Zang Hongyong
2011-12-16  7:23     ` Sasha Levin
2011-12-16  8:36       ` Zang Hongyong
2011-12-16  8:45         ` Sasha Levin
2011-12-16  9:33           ` Zang Hongyong
2011-12-16  9:46             ` Sasha Levin
2011-12-19  2:39               ` Zang Hongyong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).