"Dr. David Alan Gilbert (git)" <dgilb...@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilb...@redhat.com>
>
> postcopy_place_page (etc) provide a way for postcopy to place a page
> into guests memory atomically (using the copy ioctl on the ufd).
>
> Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com>
> Reviewed-by: Amit Shah <amit.s...@redhat.com>


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

> +int postcopy_place_page_zero(MigrationIncomingState *mis, void *host)
> +{
> +    struct uffdio_zeropage zero_struct;
> +
> +    zero_struct.range.start = (uint64_t)(uintptr_t)host;
> +    zero_struct.range.len = getpagesize();
> +    zero_struct.mode = 0;
> +
> +    if (ioctl(mis->userfault_fd, UFFDIO_ZEROPAGE, &zero_struct)) {
> +        int e = errno;
> +        error_report("%s: %s zero host: %p",
> +                     __func__, strerror(e), host);
> +
> +        return -e;
> +    }
> +
> +    trace_postcopy_place_page_zero(host);
> +    return 0;
> +}

Would this be faster than normal precopy way of just copying a zero page?

Reply via email to