qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration: not send zero page header in ram bulk stage
@ 2016-01-15  9:48 Liang Li
  2016-01-15 10:17 ` Hailiang Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Liang Li @ 2016-01-15  9:48 UTC (permalink / raw)
  To: qemu-devel
  Cc: zhang.zhanghailiang, quintela, Liang Li, dgilbert, amit.shah,
	pbonzini

Now that VM's RAM pages are initialized to zero, (VM's RAM is allcated
with the mmap() and MAP_ANONYMOUS option, or mmap() without MAP_SHARED
if hugetlbfs is used.) so there is no need to send the zero page header
to destination.

For guest just uses a small portions of RAM, this change can avoid
allocating all the guest's RAM pages in the destination node after
live migration. Another benefit is destination QEMU can save lots of
CPU cycles for zero page checking.

Signed-off-by: Liang Li <liang.z.li@intel.com>
---
 migration/ram.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/migration/ram.c b/migration/ram.c
index 4e606ab..c4821d1 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -705,10 +705,12 @@ static int save_zero_page(QEMUFile *f, RAMBlock *block, ram_addr_t offset,
 
     if (is_zero_range(p, TARGET_PAGE_SIZE)) {
         acct_info.dup_pages++;
-        *bytes_transferred += save_page_header(f, block,
-                                               offset | RAM_SAVE_FLAG_COMPRESS);
-        qemu_put_byte(f, 0);
-        *bytes_transferred += 1;
+        if (!ram_bulk_stage) {
+            *bytes_transferred += save_page_header(f, block, offset |
+                                                   RAM_SAVE_FLAG_COMPRESS);
+            qemu_put_byte(f, 0);
+            *bytes_transferred += 1;
+        }
         pages = 1;
     }
 
-- 
1.9.1

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

end of thread, other threads:[~2016-01-20  9:59 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-15  9:48 [Qemu-devel] [PATCH] migration: not send zero page header in ram bulk stage Liang Li
2016-01-15 10:17 ` Hailiang Zhang
2016-01-15 10:24   ` Li, Liang Z
2016-01-18  9:01     ` Hailiang Zhang
2016-01-19  1:26       ` Li, Liang Z
2016-01-19  3:11         ` Hailiang Zhang
2016-01-19  3:17           ` Li, Liang Z
2016-01-20  9:55             ` Paolo Bonzini
2016-01-20  9:59               ` Li, Liang Z
2016-01-19  3:25           ` Hailiang Zhang
2016-01-19  3:36             ` Li, Liang Z
2016-01-15 11:39 ` Paolo Bonzini
2016-01-16 14:12   ` Li, Liang Z
2016-01-15 18:57 ` Dr. David Alan Gilbert
2016-01-16 14:25   ` Li, Liang Z
2016-01-18  9:33     ` Dr. David Alan Gilbert
2016-01-18  9:17   ` Hailiang Zhang

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).