[libvirt RFC] virFile: new VIR_FILE_WRAPPER_BIG_PIPE to improve performance

Ani Sinha ani at anisinha.ca
Mon Mar 14 16:53:00 UTC 2022


>
> diff --git a/src/util/virfile.c b/src/util/virfile.c
> index a04f888e06..fdacd17890 100644
> --- a/src/util/virfile.c
> +++ b/src/util/virfile.c
> @@ -282,6 +282,18 @@ virFileWrapperFdNew(int *fd, const char *name, unsigned int flags)
>
>      ret->cmd = virCommandNewArgList(iohelper_path, name, NULL);
>
> +    if (flags & VIR_FILE_WRAPPER_BIG_PIPE) {
> +        /*
> +         * virsh save/resume would slow to a crawl with a default pipe size (usually 64k).
> +         * This improves the situation by 400%, although going through io_helper still incurs
> +         * in a performance penalty compared with a direct qemu migration to a socket.
> +         */
> +        int pipe_sz, rv = virFileReadValueInt(&pipe_sz, "/proc/sys/fs/pipe-max-size");
> +        if (rv != 0) {
> +            pipe_sz = 1024 * 1024; /* common default for pipe-max-size */
> +        }
> +        fcntl(pipefd[output ? 0 : 1], F_SETPIPE_SZ, pipe_sz);
> +    }

I believe this entire hunk of code should be ifdef'd within #ifdef
__linux__. non-windows does not necessarily mean only linux.



More information about the libvir-list mailing list