[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/6] migration/multifd: move MultiFDSendParams handl
From: |
Wei Yang |
Subject: |
[Qemu-devel] [PATCH 1/6] migration/multifd: move MultiFDSendParams handling into multifd_send_fill_packet() |
Date: |
Thu, 6 Jun 2019 16:34:56 +0800 |
Currently there is only one user of multifd_send_fill_packet(). We
enlarge the responsibility of it to adjust MultiFDSendParams.
Signed-off-by: Wei Yang <address@hidden>
---
migration/ram.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index bd356764ff..a4e7587648 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -787,9 +787,11 @@ static void multifd_pages_clear(MultiFDPages_t *pages)
static void multifd_send_fill_packet(MultiFDSendParams *p)
{
MultiFDPacket_t *packet = p->packet;
+ MultiFDPages_t *pages = p->pages;
uint32_t page_max = MULTIFD_PACKET_SIZE / qemu_target_page_size();
int i;
+ p->next_packet_size = pages->used * qemu_target_page_size();
packet->magic = cpu_to_be32(MULTIFD_MAGIC);
packet->version = cpu_to_be32(MULTIFD_VERSION);
packet->flags = cpu_to_be32(p->flags);
@@ -805,6 +807,10 @@ static void multifd_send_fill_packet(MultiFDSendParams *p)
for (i = 0; i < p->pages->used; i++) {
packet->offset[i] = cpu_to_be64(p->pages->offset[i]);
}
+ p->flags = 0;
+ p->num_packets++;
+ p->num_pages += pages->used;
+ p->pages->used = 0;
}
static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp)
@@ -1097,12 +1103,7 @@ static void *multifd_send_thread(void *opaque)
uint64_t packet_num = p->packet_num;
uint32_t flags = p->flags;
- p->next_packet_size = used * qemu_target_page_size();
multifd_send_fill_packet(p);
- p->flags = 0;
- p->num_packets++;
- p->num_pages += used;
- p->pages->used = 0;
qemu_mutex_unlock(&p->mutex);
trace_multifd_send(p->id, packet_num, used, flags,
--
2.19.1
- [Qemu-devel] [PATCH 0/6] multifd: a new mechanism for send thread sync, Wei Yang, 2019/06/06
- [Qemu-devel] [PATCH 2/6] migration/multifd: notify channels_ready when send thread starts, Wei Yang, 2019/06/06
- [Qemu-devel] [PATCH 4/6] migration/multifd: used must not be 0 for a pending job, Wei Yang, 2019/06/06
- [Qemu-devel] [PATCH 5/6] migration/multifd: use boolean for pending_job is enough, Wei Yang, 2019/06/06
- [Qemu-devel] [PATCH 3/6] migration/multifd: use sync field to synchronize send threads, Wei Yang, 2019/06/06
- [Qemu-devel] [PATCH 1/6] migration/multifd: move MultiFDSendParams handling into multifd_send_fill_packet(),
Wei Yang <=
- [Qemu-devel] [PATCH 6/6] migration/multifd: there is no spurious wakeup now, Wei Yang, 2019/06/06