[PATCH 3/7] migration: Remove thread_id in migration_threads_add()

Peter Xu posted 7 patches 1 month, 3 weeks ago
[PATCH 3/7] migration: Remove thread_id in migration_threads_add()
Posted by Peter Xu 1 month, 3 weeks ago
It always fetches the ID of the curren thread, so there's no point passing
it over.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 migration/threadinfo.h | 2 +-
 migration/migration.c  | 3 +--
 migration/multifd.c    | 2 +-
 migration/threadinfo.c | 5 +++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/migration/threadinfo.h b/migration/threadinfo.h
index 2f356ff312..d0e4ab0aa3 100644
--- a/migration/threadinfo.h
+++ b/migration/threadinfo.h
@@ -21,5 +21,5 @@ struct MigrationThread {
     QLIST_ENTRY(MigrationThread) node;
 };
 
-MigrationThread *migration_threads_add(const char *name, int thread_id);
+MigrationThread *migration_threads_add(const char *name);
 void migration_threads_remove(MigrationThread *info);
diff --git a/migration/migration.c b/migration/migration.c
index 813c45ad04..1ddcf54a70 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3467,8 +3467,7 @@ static void *migration_thread(void *opaque)
     Error *local_err = NULL;
     int ret;
 
-    thread = migration_threads_add(MIGRATION_THREAD_SRC_MAIN,
-                                   qemu_get_thread_id());
+    thread = migration_threads_add(MIGRATION_THREAD_SRC_MAIN);
 
     rcu_register_thread();
 
diff --git a/migration/multifd.c b/migration/multifd.c
index 697fe86fdf..04db886c7e 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -575,7 +575,7 @@ static void *multifd_send_thread(void *opaque)
     int ret = 0;
     bool use_packets = multifd_use_packets();
 
-    thread = migration_threads_add(p->name, qemu_get_thread_id());
+    thread = migration_threads_add(p->name);
 
     trace_multifd_send_thread_start(p->id);
     rcu_register_thread();
diff --git a/migration/threadinfo.c b/migration/threadinfo.c
index 262990dd75..8069413091 100644
--- a/migration/threadinfo.c
+++ b/migration/threadinfo.c
@@ -23,11 +23,12 @@ static void __attribute__((constructor)) migration_threads_init(void)
     qemu_mutex_init(&migration_threads_lock);
 }
 
-MigrationThread *migration_threads_add(const char *name, int thread_id)
+MigrationThread *migration_threads_add(const char *name)
 {
     MigrationThread *thread =  g_new0(MigrationThread, 1);
+
     thread->name = name;
-    thread->thread_id = thread_id;
+    thread->thread_id = qemu_get_thread_id();
 
     WITH_QEMU_LOCK_GUARD(&migration_threads_lock) {
         QLIST_INSERT_HEAD(&migration_threads, thread, node);
-- 
2.45.0