aboutsummaryrefslogtreecommitdiffstats
path: root/vl.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2009-06-17 16:46:12 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-22 10:15:28 -0500
commit30868442a5590991266a34af3f0b728a4a0ee6d0 (patch)
tree24f2dc2fa45cd72922f95b4250cbb401027825da /vl.c
parentb09ea7d55cfab5a75912bb56ed1fcd757604a759 (diff)
Instead of writing a zero page, madvise it away
Otherwise, after migration, we end up with a much larger RSS size then we ought to have. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index 2d9f04e4c..ca26450e3 100644
--- a/vl.c
+++ b/vl.c
@@ -3346,6 +3346,12 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
if (flags & RAM_SAVE_FLAG_COMPRESS) {
uint8_t ch = qemu_get_byte(f);
+#if defined(__linux__)
+ if (ch == 0 &&
+ (!kvm_enabled() || kvm_has_sync_mmu())) {
+ madvise(qemu_get_ram_ptr(addr), TARGET_PAGE_SIZE, MADV_DONTNEED);
+ } else
+#endif
memset(qemu_get_ram_ptr(addr), ch, TARGET_PAGE_SIZE);
} else if (flags & RAM_SAVE_FLAG_PAGE)
qemu_get_buffer(f, qemu_get_ram_ptr(addr), TARGET_PAGE_SIZE);