diff options
author | Juan Quintela <quintela@redhat.com> | 2017-06-28 11:52:28 +0200 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2017-07-10 17:52:21 +0100 |
commit | f0afa331ce670ba39bde3f5620d75dcd56890cb6 (patch) | |
tree | 77687a22e3c6a33e8f05358189932c2a45ef91df /migration | |
parent | f265e0e437a5d5fd0b48143012e2242b85816f61 (diff) |
migration: Make compression_threads use save/load_setup/cleanup()
Once there, be consistent and use
compress_thread_{save,load}_{setup,cleanup}.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20170628095228.4661-6-quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r-- | migration/migration.c | 5 | ||||
-rw-r--r-- | migration/ram.c | 12 | ||||
-rw-r--r-- | migration/ram.h | 5 |
3 files changed, 8 insertions, 14 deletions
diff --git a/migration/migration.c b/migration/migration.c index 7e5dbd9b92..a0db40d364 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -286,7 +286,6 @@ static void process_incoming_migration_bh(void *opaque) } else { runstate_set(global_state_get_runstate()); } - migrate_decompress_threads_join(); /* * This must happen after any state changes since as soon as an external * observer sees this event they might start to prod at the VM assuming @@ -349,7 +348,6 @@ static void process_incoming_migration_co(void *opaque) migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); error_report("load of migration failed: %s", strerror(-ret)); - migrate_decompress_threads_join(); exit(EXIT_FAILURE); } mis->bh = qemu_bh_new(process_incoming_migration_bh, mis); @@ -360,7 +358,6 @@ void migration_fd_process_incoming(QEMUFile *f) { Coroutine *co = qemu_coroutine_create(process_incoming_migration_co, f); - migrate_decompress_threads_create(); qemu_file_set_blocking(f, false); qemu_coroutine_enter(co); } @@ -827,7 +824,6 @@ static void migrate_fd_cleanup(void *opaque) } qemu_mutex_lock_iothread(); - migrate_compress_threads_join(); qemu_fclose(s->to_dst_file); s->to_dst_file = NULL; } @@ -1990,7 +1986,6 @@ void migrate_fd_connect(MigrationState *s) } } - migrate_compress_threads_create(); qemu_thread_create(&s->thread, "live_migration", migration_thread, s, QEMU_THREAD_JOINABLE); s->migration_thread_running = true; diff --git a/migration/ram.c b/migration/ram.c index 73aec34161..1b08296d1b 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -306,7 +306,7 @@ static inline void terminate_compression_threads(void) } } -void migrate_compress_threads_join(void) +static void compress_threads_save_cleanup(void) { int i, thread_count; @@ -329,7 +329,7 @@ void migrate_compress_threads_join(void) comp_param = NULL; } -void migrate_compress_threads_create(void) +static void compress_threads_save_setup(void) { int i, thread_count; @@ -1390,6 +1390,7 @@ static void ram_save_cleanup(void *opaque) } XBZRLE_cache_unlock(); migration_page_queue_free(*rsp); + compress_threads_save_cleanup(); g_free(*rsp); *rsp = NULL; } @@ -1923,6 +1924,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque) } rcu_read_unlock(); + compress_threads_save_setup(); ram_control_before_iterate(f, RAM_CONTROL_SETUP); ram_control_after_iterate(f, RAM_CONTROL_SETUP); @@ -2231,7 +2233,7 @@ static void wait_for_decompress_done(void) qemu_mutex_unlock(&decomp_done_lock); } -void migrate_decompress_threads_create(void) +static void compress_threads_load_setup(void) { int i, thread_count; @@ -2255,7 +2257,7 @@ void migrate_decompress_threads_create(void) } } -void migrate_decompress_threads_join(void) +static void compress_threads_load_cleanup(void) { int i, thread_count; @@ -2321,12 +2323,14 @@ static void decompress_data_with_multi_threads(QEMUFile *f, static int ram_load_setup(QEMUFile *f, void *opaque) { xbzrle_load_setup(); + compress_threads_load_setup(); return 0; } static int ram_load_cleanup(void *opaque) { xbzrle_load_cleanup(); + compress_threads_load_cleanup(); return 0; } diff --git a/migration/ram.h b/migration/ram.h index a8b79a4d4c..c081fde86c 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -39,11 +39,6 @@ int64_t xbzrle_cache_resize(int64_t new_size); uint64_t ram_bytes_remaining(void); uint64_t ram_bytes_total(void); -void migrate_compress_threads_create(void); -void migrate_compress_threads_join(void); -void migrate_decompress_threads_create(void); -void migrate_decompress_threads_join(void); - uint64_t ram_pagesize_summary(void); int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len); void acct_update_position(QEMUFile *f, size_t size, bool zero); |