OSDN Git Service

multifd: Use normal pages array on the send side
authorJuan Quintela <quintela@redhat.com>
Mon, 22 Nov 2021 12:26:18 +0000 (13:26 +0100)
committerJuan Quintela <quintela@redhat.com>
Fri, 28 Jan 2022 14:38:23 +0000 (15:38 +0100)
commit815956f03902980c771da64b17f7f791c1cb57b0
tree6985aac34b627d69400ec80cc62c17754283a6b4
parentc27779a215843e92eb120de80f982f3a63d1becb
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 <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---

Improving comment (dave)
Renaming num_normal_pages to total_normal_pages (peter)
migration/multifd-zlib.c
migration/multifd-zstd.c
migration/multifd.c
migration/multifd.h
migration/trace-events