From 815956f03902980c771da64b17f7f791c1cb57b0 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Mon, 22 Nov 2021 13:26:18 +0100 Subject: multifd: Use normal pages array on the send side We are only sending normal pages through multifd channels. Later on this series, we are going to also send zero pages. We are going to detect if a page is zero or non zero in the multifd channel thread, not on the main thread. So we receive an array of pages page->offset[N] And we will end with: p->normal[N - zero_pages] p->zero[zero_pages]. In this patch, we just copy all the pages in offset to normal. for (i = 0; i < pages->num; i++) { p->narmal[p->normal_num] = pages->offset[i]; p->normal_num++: } Later in the series this becomes: for (i = 0; i < pages->num; i++) { if (buffer_is_zero(page->offset[i])) { p->zerol[p->zero_num] = pages->offset[i]; p->zero_num++: } else { p->narmal[p->normal_num] = pages->offset[i]; p->normal_num++: } } Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- Improving comment (dave) Renaming num_normal_pages to total_normal_pages (peter) --- migration/multifd.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'migration/multifd.h') diff --git a/migration/multifd.h b/migration/multifd.h index 7496f951a7..7823199dbe 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -104,14 +104,18 @@ typedef struct { /* thread local variables */ /* packets sent through this channel */ uint64_t num_packets; - /* pages sent through this channel */ - uint64_t num_pages; + /* non zero pages sent through this channel */ + uint64_t total_normal_pages; /* syncs main thread and channels */ QemuSemaphore sem_sync; /* buffers to send */ struct iovec *iov; /* number of iovs used */ uint32_t iovs_num; + /* Pages that are not zero */ + ram_addr_t *normal; + /* num of non zero pages */ + uint32_t normal_num; /* used for compression methods */ void *data; } MultiFDSendParams; -- cgit v1.2.3