diff mbox series

[2/4] migration/multifd: use pages->allocated instead of the static max

Message ID 20191011085050.17622-3-richardw.yang@linux.intel.com
State New
Headers show
Series migration/multifd: trivial cleanup for multifd | expand

Commit Message

Wei Yang Oct. 11, 2019, 8:50 a.m. UTC
multifd_send_fill_packet() prepares meta data for following pages to
transfer. It would be more proper to fill pages->allocated instead of
static max value, especially we want to support flexible packet size.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 migration/ram.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Juan Quintela Oct. 11, 2019, 10:31 a.m. UTC | #1
Wei Yang <richardw.yang@linux.intel.com> wrote:
> multifd_send_fill_packet() prepares meta data for following pages to
> transfer. It would be more proper to fill pages->allocated instead of
> static max value, especially we want to support flexible packet size.
>
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

It don't really matters.  We send full packets except the last one or
somesuch extern reason.  Only makes a difference if for that channel
only is sent a partial packet.
diff mbox series

Patch

diff --git a/migration/ram.c b/migration/ram.c
index cf30171f44..6a3bef0434 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -791,13 +791,12 @@  static void multifd_pages_clear(MultiFDPages_t *pages)
 static void multifd_send_fill_packet(MultiFDSendParams *p)
 {
     MultiFDPacket_t *packet = p->packet;
-    uint32_t page_max = MULTIFD_PACKET_SIZE / qemu_target_page_size();
     int i;
 
     packet->magic = cpu_to_be32(MULTIFD_MAGIC);
     packet->version = cpu_to_be32(MULTIFD_VERSION);
     packet->flags = cpu_to_be32(p->flags);
-    packet->pages_alloc = cpu_to_be32(page_max);
+    packet->pages_alloc = cpu_to_be32(p->pages->allocated);
     packet->pages_used = cpu_to_be32(p->pages->used);
     packet->next_packet_size = cpu_to_be32(p->next_packet_size);
     packet->packet_num = cpu_to_be64(p->packet_num);