[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 32/38] migration: Introduce ram_transferred_add()
From: |
Juan Quintela |
Subject: |
[PULL 32/38] migration: Introduce ram_transferred_add() |
Date: |
Thu, 27 Jan 2022 16:05:42 +0100 |
From: David Edmondson <david.edmondson@oracle.com>
Replace direct manipulation of ram_counters.transferred with a
function.
Signed-off-by: David Edmondson <david.edmondson@oracle.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/ram.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 1771bbdb02..619a1d9a6b 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -387,6 +387,11 @@ uint64_t ram_bytes_remaining(void)
MigrationStats ram_counters;
+static void ram_transferred_add(uint64_t bytes)
+{
+ ram_counters.transferred += bytes;
+}
+
/* used by the search for pages to send */
struct PageSearchStatus {
/* Current block being searched */
@@ -767,7 +772,7 @@ static int save_xbzrle_page(RAMState *rs, uint8_t
**current_data,
* RAM_SAVE_FLAG_CONTINUE.
*/
xbzrle_counters.bytes += bytes_xbzrle - 8;
- ram_counters.transferred += bytes_xbzrle;
+ ram_transferred_add(bytes_xbzrle);
return 1;
}
@@ -1208,7 +1213,7 @@ static int save_zero_page(RAMState *rs, RAMBlock *block,
ram_addr_t offset)
if (len) {
ram_counters.duplicate++;
- ram_counters.transferred += len;
+ ram_transferred_add(len);
return 1;
}
return -1;
@@ -1235,7 +1240,7 @@ static bool control_save_page(RAMState *rs, RAMBlock
*block, ram_addr_t offset,
}
if (bytes_xmit) {
- ram_counters.transferred += bytes_xmit;
+ ram_transferred_add(bytes_xmit);
*pages = 1;
}
@@ -1266,8 +1271,8 @@ static bool control_save_page(RAMState *rs, RAMBlock
*block, ram_addr_t offset,
static int save_normal_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,
uint8_t *buf, bool async)
{
- ram_counters.transferred += save_page_header(rs, rs->f, block,
- offset | RAM_SAVE_FLAG_PAGE);
+ ram_transferred_add(save_page_header(rs, rs->f, block,
+ offset | RAM_SAVE_FLAG_PAGE));
if (async) {
qemu_put_buffer_async(rs->f, buf, TARGET_PAGE_SIZE,
migrate_release_ram() &
@@ -1275,7 +1280,7 @@ static int save_normal_page(RAMState *rs, RAMBlock
*block, ram_addr_t offset,
} else {
qemu_put_buffer(rs->f, buf, TARGET_PAGE_SIZE);
}
- ram_counters.transferred += TARGET_PAGE_SIZE;
+ ram_transferred_add(TARGET_PAGE_SIZE);
ram_counters.normal++;
return 1;
}
@@ -1367,7 +1372,7 @@ static bool do_compress_ram_page(QEMUFile *f, z_stream
*stream, RAMBlock *block,
static void
update_compress_thread_counts(const CompressParam *param, int bytes_xmit)
{
- ram_counters.transferred += bytes_xmit;
+ ram_transferred_add(bytes_xmit);
if (param->zero_page) {
ram_counters.duplicate++;
@@ -2284,7 +2289,7 @@ void acct_update_position(QEMUFile *f, size_t size, bool
zero)
ram_counters.duplicate += pages;
} else {
ram_counters.normal += pages;
- ram_counters.transferred += size;
+ ram_transferred_add(size);
qemu_update_position(f, size);
}
}
@@ -3040,7 +3045,7 @@ out:
multifd_send_sync_main(rs->f);
qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
qemu_fflush(f);
- ram_counters.transferred += 8;
+ ram_transferred_add(8);
ret = qemu_file_get_error(f);
}
--
2.34.1
- [PULL 22/38] migration: Report the error returned when save_live_iterate fails, (continued)
- [PULL 22/38] migration: Report the error returned when save_live_iterate fails, Juan Quintela, 2022/01/27
- [PULL 23/38] migration: Add canary to VMSTATE_END_OF_LIST, Juan Quintela, 2022/01/27
- [PULL 25/38] migration/ram: clean up unused comment., Juan Quintela, 2022/01/27
- [PULL 24/38] migration: Perform vmsd structure check during tests, Juan Quintela, 2022/01/27
- [PULL 26/38] migration: Drop dead code of ram_debug_dump_bitmap(), Juan Quintela, 2022/01/27
- [PULL 28/38] migration: Drop postcopy_chunk_hostpages(), Juan Quintela, 2022/01/27
- [PULL 27/38] migration: Don't return for postcopy_chunk_hostpages(), Juan Quintela, 2022/01/27
- [PULL 29/38] migration: Do chunk page in postcopy_each_ram_send_discard(), Juan Quintela, 2022/01/27
- [PULL 30/38] migration: Drop return code for disgard ram process, Juan Quintela, 2022/01/27
- [PULL 31/38] migration: Don't return for postcopy_send_discard_bm_ram(), Juan Quintela, 2022/01/27
- [PULL 32/38] migration: Introduce ram_transferred_add(),
Juan Quintela <=
- [PULL 33/38] migration: Tally pre-copy, downtime and post-copy bytes independently, Juan Quintela, 2022/01/27
- [PULL 34/38] migration: No off-by-one for pss->page update in host page size, Juan Quintela, 2022/01/27
- [PULL 35/38] migration: Enable UFFD_FEATURE_THREAD_ID even without blocktime feat, Juan Quintela, 2022/01/27
- [PULL 36/38] migration: Add postcopy_has_request(), Juan Quintela, 2022/01/27
- [PULL 37/38] migration: Simplify unqueue_page(), Juan Quintela, 2022/01/27
- [PULL 38/38] migration: Move temp page setup and cleanup into separate functions, Juan Quintela, 2022/01/27
- Re: [PULL 00/38] Migration 20220127 patches, Peter Maydell, 2022/01/28