[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/8] Only calculate expected_time for stage 2
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 5/8] Only calculate expected_time for stage 2 |
Date: |
Fri, 22 Jun 2012 15:46:16 +0200 |
ram_save_remaining() is an expensive operation when there is a lot of memory.
So we only call the function when we need it.
Signed-off-by: Juan Quintela <address@hidden>
---
arch_init.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index a9e8b74..424efe7 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -299,7 +299,6 @@ int ram_save_live(QEMUFile *f, int stage, void *opaque)
ram_addr_t addr;
uint64_t bytes_transferred_last;
double bwidth = 0;
- uint64_t expected_time = 0;
int ret;
if (stage < 0) {
@@ -376,9 +375,12 @@ int ram_save_live(QEMUFile *f, int stage, void *opaque)
qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
- expected_time = ram_save_remaining() * TARGET_PAGE_SIZE / bwidth;
-
- return (stage == 2) && (expected_time <= migrate_max_downtime());
+ if (stage == 2) {
+ uint64_t expected_time;
+ expected_time = ram_save_remaining() * TARGET_PAGE_SIZE / bwidth;
+ return expected_time <= migrate_max_downtime();
+ }
+ return 0;
}
static inline void *host_from_stream_offset(QEMUFile *f,
--
1.7.10.2
- [Qemu-devel] [PATCH 3/8] No need to iterate if we already are over the limit, (continued)
- [Qemu-devel] [PATCH 3/8] No need to iterate if we already are over the limit, Juan Quintela, 2012/06/22
- [Qemu-devel] [PATCH 1/8] Add spent time for migration, Juan Quintela, 2012/06/22
- [Qemu-devel] [PATCH 7/8] dirty bitmap: abstract its use, Juan Quintela, 2012/06/22
- [Qemu-devel] [PATCH 6/8] Exit loop if we have been there too long, Juan Quintela, 2012/06/22
- [Qemu-devel] [PATCH 4/8] Only TCG needs TLB handling, Juan Quintela, 2012/06/22
- [Qemu-devel] [PATCH 5/8] Only calculate expected_time for stage 2,
Juan Quintela <=
- [Qemu-devel] [PATCH 8/8] Maintain the number of dirty pages, Juan Quintela, 2012/06/22