[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/38] multifd: Use a single writev on the send side
From: |
Juan Quintela |
Subject: |
[PULL 12/38] multifd: Use a single writev on the send side |
Date: |
Thu, 27 Jan 2022 16:05:22 +0100 |
Until now, we wrote the packet header with write(), and the rest of the
pages with writev(). Just increase the size of the iovec and do a
single writev().
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/multifd.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/migration/multifd.c b/migration/multifd.c
index 96b9cc0d8b..1d4885e1a0 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -646,7 +646,7 @@ static void *multifd_send_thread(void *opaque)
uint32_t used = p->pages->num;
uint64_t packet_num = p->packet_num;
uint32_t flags = p->flags;
- p->iovs_num = 0;
+ p->iovs_num = 1;
if (used) {
ret = multifd_send_state->ops->send_prepare(p, &local_err);
@@ -666,20 +666,15 @@ static void *multifd_send_thread(void *opaque)
trace_multifd_send(p->id, packet_num, used, flags,
p->next_packet_size);
- ret = qio_channel_write_all(p->c, (void *)p->packet,
- p->packet_len, &local_err);
+ p->iov[0].iov_len = p->packet_len;
+ p->iov[0].iov_base = p->packet;
+
+ ret = qio_channel_writev_all(p->c, p->iov, p->iovs_num,
+ &local_err);
if (ret != 0) {
break;
}
- if (used) {
- ret = qio_channel_writev_all(p->c, p->iov, p->iovs_num,
- &local_err);
- if (ret != 0) {
- break;
- }
- }
-
qemu_mutex_lock(&p->mutex);
p->pending_job--;
qemu_mutex_unlock(&p->mutex);
@@ -916,7 +911,8 @@ int multifd_save_setup(Error **errp)
p->packet->version = cpu_to_be32(MULTIFD_VERSION);
p->name = g_strdup_printf("multifdsend_%d", i);
p->tls_hostname = g_strdup(s->hostname);
- p->iov = g_new0(struct iovec, page_count);
+ /* We need one extra place for the packet header */
+ p->iov = g_new0(struct iovec, page_count + 1);
socket_send_channel_create(multifd_new_send_channel_async, p);
}
--
2.34.1
- [PULL 01/38] migration: All this fields are unsigned, (continued)
- [PULL 01/38] migration: All this fields are unsigned, Juan Quintela, 2022/01/27
- [PULL 03/38] migration: ram_release_pages() always receive 1 page as argument, Juan Quintela, 2022/01/27
- [PULL 04/38] migration: Remove masking for compression, Juan Quintela, 2022/01/27
- [PULL 05/38] migration: simplify do_compress_ram_page, Juan Quintela, 2022/01/27
- [PULL 06/38] migration: Move ram_release_pages() call to save_zero_page_to_file(), Juan Quintela, 2022/01/27
- [PULL 07/38] multifd: Use proper maximum compression values, Juan Quintela, 2022/01/27
- [PULL 08/38] multifd: Move iov from pages to params, Juan Quintela, 2022/01/27
- [PULL 09/38] multifd: Make zlib use iov's, Juan Quintela, 2022/01/27
- [PULL 11/38] multifd: Remove send_write() method, Juan Quintela, 2022/01/27
- [PULL 10/38] multifd: Make zstd use iov's, Juan Quintela, 2022/01/27
- [PULL 12/38] multifd: Use a single writev on the send side,
Juan Quintela <=
- [PULL 13/38] multifd: Unfold "used" variable by its value, Juan Quintela, 2022/01/27
- [PULL 14/38] multifd: Use normal pages array on the send side, Juan Quintela, 2022/01/27
- [PULL 16/38] multifd: recv side only needs the RAMBlock host address, Juan Quintela, 2022/01/27
- [PULL 15/38] multifd: Use normal pages array on the recv side, Juan Quintela, 2022/01/27
- [PULL 17/38] multifd: Rename pages_used to normal_pages, Juan Quintela, 2022/01/27
- [PULL 18/38] Remove unnecessary minimum_version_id_old fields, Juan Quintela, 2022/01/27
- [PULL 19/38] migration/migration.c: Add missed default error handler for migration state, Juan Quintela, 2022/01/27
- [PULL 20/38] migration/migration.c: Avoid COLO boot in postcopy migration, Juan Quintela, 2022/01/27
- [PULL 21/38] migration/migration.c: Remove the MIGRATION_STATUS_ACTIVE when migration finished, Juan Quintela, 2022/01/27
- [PULL 22/38] migration: Report the error returned when save_live_iterate fails, Juan Quintela, 2022/01/27