[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 23/51] ram: Everything was init to zero, so use mems
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 23/51] ram: Everything was init to zero, so use memset |
Date: |
Thu, 23 Mar 2017 21:45:16 +0100 |
And then init only things that are not zero by default.
Signed-off-by: Juan Quintela <address@hidden>
---
migration/ram.c | 25 +++----------------------
1 file changed, 3 insertions(+), 22 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index c6ba92c..a890179 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -611,15 +611,6 @@ static void migration_bitmap_sync_range(RAMState *rs,
ram_addr_t start,
&rs->num_dirty_pages_period);
}
-static void migration_bitmap_sync_init(RAMState *rs)
-{
- rs->start_time = 0;
- rs->bytes_xfer_prev = 0;
- rs->num_dirty_pages_period = 0;
- rs->xbzrle_cache_miss_prev = 0;
- rs->iterations_prev = 0;
-}
-
/**
* ram_pagesize_summary: calculate all the pagesizes of a VM
*
@@ -1984,21 +1975,11 @@ err:
return ret;
}
-static int ram_save_init_globals(RAMState *rs)
+static int ram_state_init(RAMState *rs)
{
int64_t ram_bitmap_pages; /* Size of bitmap in pages, including gaps */
- rs->dirty_rate_high_cnt = 0;
- rs->bitmap_sync_count = 0;
- rs->zero_pages = 0;
- rs->norm_pages = 0;
- rs->iterations = 0;
- rs->xbzrle_bytes = 0;
- rs->xbzrle_pages = 0;
- rs->xbzrle_cache_miss = 0;
- rs->xbzrle_cache_miss_rate = 0;
- rs->xbzrle_overflows = 0;
- migration_bitmap_sync_init(rs);
+ memset(rs, 0, sizeof(*rs));
qemu_mutex_init(&migration_bitmap_mutex);
if (migrate_use_xbzrle()) {
@@ -2088,7 +2069,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
/* migration has already setup the bitmap, reuse it. */
if (!migration_in_colo_state()) {
- if (ram_save_init_globals(rs) < 0) {
+ if (ram_state_init(rs) < 0) {
return -1;
}
}
--
2.9.3
- Re: [Qemu-devel] [PATCH 19/51] ram: Move xbzrle_cache_miss into RAMState, (continued)
- [Qemu-devel] [PATCH 20/51] ram: Move xbzrle_cache_miss_rate into RAMState, Juan Quintela, 2017/03/23
- [Qemu-devel] [PATCH 21/51] ram: Move xbzrle_overflows into RAMState, Juan Quintela, 2017/03/23
- [Qemu-devel] [PATCH 22/51] ram: Move migration_dirty_pages to RAMState, Juan Quintela, 2017/03/23
- [Qemu-devel] [PATCH 23/51] ram: Everything was init to zero, so use memset,
Juan Quintela <=
- [Qemu-devel] [PATCH 24/51] ram: Move migration_bitmap_mutex into RAMState, Juan Quintela, 2017/03/23
- [Qemu-devel] [PATCH 25/51] ram: Move migration_bitmap_rcu into RAMState, Juan Quintela, 2017/03/23
- [Qemu-devel] [PATCH 26/51] ram: Move bytes_transferred into RAMState, Juan Quintela, 2017/03/23