• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisãod48c3a044537689866fe44e65d24c7d39a68868a (tree)
Hora2022-01-28 23:38:23
AutorJuan Quintela <quintela@redh...>
CommiterJuan Quintela

Mensagem de Log

multifd: Use a single writev on the send side

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>

Mudança Sumário

Diff

--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -646,7 +646,7 @@ static void *multifd_send_thread(void *opaque)
646646 uint32_t used = p->pages->num;
647647 uint64_t packet_num = p->packet_num;
648648 uint32_t flags = p->flags;
649- p->iovs_num = 0;
649+ p->iovs_num = 1;
650650
651651 if (used) {
652652 ret = multifd_send_state->ops->send_prepare(p, &local_err);
@@ -666,20 +666,15 @@ static void *multifd_send_thread(void *opaque)
666666 trace_multifd_send(p->id, packet_num, used, flags,
667667 p->next_packet_size);
668668
669- ret = qio_channel_write_all(p->c, (void *)p->packet,
670- p->packet_len, &local_err);
669+ p->iov[0].iov_len = p->packet_len;
670+ p->iov[0].iov_base = p->packet;
671+
672+ ret = qio_channel_writev_all(p->c, p->iov, p->iovs_num,
673+ &local_err);
671674 if (ret != 0) {
672675 break;
673676 }
674677
675- if (used) {
676- ret = qio_channel_writev_all(p->c, p->iov, p->iovs_num,
677- &local_err);
678- if (ret != 0) {
679- break;
680- }
681- }
682-
683678 qemu_mutex_lock(&p->mutex);
684679 p->pending_job--;
685680 qemu_mutex_unlock(&p->mutex);
@@ -916,7 +911,8 @@ int multifd_save_setup(Error **errp)
916911 p->packet->version = cpu_to_be32(MULTIFD_VERSION);
917912 p->name = g_strdup_printf("multifdsend_%d", i);
918913 p->tls_hostname = g_strdup(s->hostname);
919- p->iov = g_new0(struct iovec, page_count);
914+ /* We need one extra place for the packet header */
915+ p->iov = g_new0(struct iovec, page_count + 1);
920916 socket_send_channel_create(multifd_new_send_channel_async, p);
921917 }
922918