[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 22/22] ram: save live optimization
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 22/22] ram: save live optimization |
Date: |
Fri, 13 Jul 2012 09:23:44 +0200 |
Optimize stage3 (complete), to use the page cached if it is there, but
not update the cache with new pages (they will never be reused).
Signed-off-by: Juan Quintela <address@hidden>
---
arch_init.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index ab3fb2c..de2d801 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -276,7 +276,7 @@ static void save_block_hdr(QEMUFile *f, RAMBlock *block,
ram_addr_t offset,
static int save_xbzrle_page(QEMUFile *f, uint8_t *current_data,
ram_addr_t current_addr, RAMBlock *block,
- ram_addr_t offset, int cont)
+ ram_addr_t offset, int cont, bool last_stage)
{
int encoded_len = 0, bytes_sent = -1, ret = -1;
XBZRLEHeader hdr = {
@@ -341,7 +341,7 @@ static ram_addr_t last_offset;
* n: the amount of bytes written in other case
*/
-static int ram_save_block(QEMUFile *f)
+static int ram_save_block(QEMUFile *f, bool last_stage)
{
RAMBlock *block = last_block;
ram_addr_t offset = last_offset;
@@ -372,8 +372,10 @@ static int ram_save_block(QEMUFile *f)
} else if (migrate_use_xbzrle()) {
current_addr = block->offset + offset;
bytes_sent = save_xbzrle_page(f, p, current_addr, block,
- offset, cont);
- p = get_cached_data(XBZRLE.cache, current_addr);
+ offset, cont, last_stage);
+ if ((bytes_sent != -1) || !last_stage) {
+ p = get_cached_data(XBZRLE.cache, current_addr);
+ }
}
/* either we didn't send yet (we may have had XBZRLE overflow) */
@@ -543,7 +545,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
while ((ret = qemu_file_rate_limit(f)) == 0) {
int bytes_sent;
- bytes_sent = ram_save_block(f);
+ bytes_sent = ram_save_block(f, false);
/* no more blocks to sent */
if (bytes_sent < 0) {
break;
@@ -605,7 +607,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
while (true) {
int bytes_sent;
- bytes_sent = ram_save_block(f);
+ bytes_sent = ram_save_block(f, true);
/* no more blocks to sent */
if (bytes_sent < 0) {
break;
--
1.7.10.4
- [Qemu-devel] [PATCH 14/22] Add XBZRLE documentation, (continued)
- [Qemu-devel] [PATCH 14/22] Add XBZRLE documentation, Juan Quintela, 2012/07/13
- [Qemu-devel] [PATCH 17/22] Change ram_save_block to return -1 if there are no more changes, Juan Quintela, 2012/07/13
- [Qemu-devel] [PATCH 18/22] Add xbzrle_encode_buffer and xbzrle_decode_buffer functions, Juan Quintela, 2012/07/13
- [Qemu-devel] [PATCH 19/22] Add XBZRLE to ram_save_block and ram_save_live, Juan Quintela, 2012/07/13
- [Qemu-devel] [PATCH 16/22] Add uleb encoding/decoding functions, Juan Quintela, 2012/07/13
- [Qemu-devel] [PATCH 15/22] Add cache handling functions, Juan Quintela, 2012/07/13
- [Qemu-devel] [PATCH 21/22] Add XBZRLE statistics, Juan Quintela, 2012/07/13
- [Qemu-devel] [PATCH 20/22] Add migrate_set_cachesize command, Juan Quintela, 2012/07/13
- [Qemu-devel] [PATCH 22/22] ram: save live optimization,
Juan Quintela <=