qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away
Date: Mon, 22 Jun 2009 15:51:06 -0000

From: Anthony Liguori <address@hidden>

Otherwise, after migration, we end up with a much larger RSS size then we
ought to have.

Signed-off-by: Anthony Liguori <address@hidden>

diff --git a/vl.c b/vl.c
index 2d9f04e..ca26450 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);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]