From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: Prasad Pandit <ppandit@redhat.com>,
Julia Suvorova <jusual@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
peterx@redhat.com, Fabiano Rosas <farosas@suse.de>,
Juraj Marcin <jmarcin@redhat.com>,
"Dr . David Alan Gilbert" <dave@treblig.org>
Subject: [PATCH 3/7] migration: Remove thread_id in migration_threads_add()
Date: Mon, 30 Sep 2024 15:58:33 -0400 [thread overview]
Message-ID: <20240930195837.825728-4-peterx@redhat.com> (raw)
In-Reply-To: <20240930195837.825728-1-peterx@redhat.com>
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
next prev parent reply other threads:[~2024-09-30 20:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 19:58 [PATCH 0/7] migration: query-migrationthreads enhancements and cleanups Peter Xu
2024-09-30 19:58 ` [PATCH 1/7] migration: Unify names of migration src main thread Peter Xu
2024-09-30 19:58 ` [PATCH 2/7] migration: Put thread names together with macros Peter Xu
2024-09-30 19:58 ` Peter Xu [this message]
2024-09-30 19:58 ` [PATCH 4/7] migration: Simplify migration-threads API Peter Xu
2024-09-30 19:58 ` [PATCH 5/7] migration: Add all threads with QMP query-migrationthreads Peter Xu
2024-09-30 19:58 ` [PATCH 6/7] migration: Remove MigrationThread and threadinfo.h Peter Xu
2024-09-30 19:58 ` [PATCH 7/7] hmp: Add "info migrationthreads" Peter Xu
2024-09-30 23:43 ` Dr. David Alan Gilbert
2024-10-01 5:46 ` [PATCH 0/7] migration: query-migrationthreads enhancements and cleanups Markus Armbruster
2024-10-01 14:25 ` Daniel P. Berrangé
2024-10-01 15:06 ` Peter Xu
2024-10-02 5:58 ` Markus Armbruster
2024-10-10 19:46 ` Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240930195837.825728-4-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=farosas@suse.de \
--cc=jmarcin@redhat.com \
--cc=jusual@redhat.com \
--cc=ppandit@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).