Skip to content

Commit

Permalink
migration: calculate expected_downtime
Browse files Browse the repository at this point in the history
We removed the calculation in commit e4ed154

Now we add it back.  We need to create dirty_bytes_rate because we
can't include cpu-all.h from migration.c, and there is no other way to
include TARGET_PAGE_SIZE.

Signed-off-by: Juan Quintela <quintela@redhat.com>


Reviewed-by: Orit Wasserman <owasserm@redhat.com>
  • Loading branch information
Juan Quintela committed Feb 22, 2013
1 parent 7161082 commit 90f8ae7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch_init.c
Expand Up @@ -414,6 +414,7 @@ static void migration_bitmap_sync(void)
if (end_time > start_time + 1000) {
s->dirty_pages_rate = num_dirty_pages_period * 1000
/ (end_time - start_time);
s->dirty_bytes_rate = s->dirty_pages_rate * TARGET_PAGE_SIZE;
start_time = end_time;
num_dirty_pages_period = 0;
}
Expand Down
1 change: 1 addition & 0 deletions include/migration/migration.h
Expand Up @@ -51,6 +51,7 @@ struct MigrationState
int64_t downtime;
int64_t expected_downtime;
int64_t dirty_pages_rate;
int64_t dirty_bytes_rate;
bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
int64_t xbzrle_cache_size;
bool complete;
Expand Down
5 changes: 5 additions & 0 deletions migration.c
Expand Up @@ -738,6 +738,11 @@ static void *buffered_file_thread(void *opaque)
DPRINTF("transferred %" PRIu64 " time_spent %" PRIu64
" bandwidth %g max_size %" PRId64 "\n",
transferred_bytes, time_spent, bandwidth, max_size);
/* if we haven't sent anything, we don't want to recalculate
10000 is a small enough number for our purposes */
if (s->dirty_bytes_rate && transferred_bytes > 10000) {
s->expected_downtime = s->dirty_bytes_rate / bandwidth;
}

s->bytes_xfer = 0;
sleep_time = 0;
Expand Down

0 comments on commit 90f8ae7

Please sign in to comment.