[Spice-devel] [PATCH spice-server] reds-stream: Small syscall optimisation

Christophe Fergeau cfergeau at redhat.com
Thu Mar 23 11:27:42 UTC 2017


On Mon, Mar 13, 2017 at 09:51:26AM +0000, Frediano Ziglio wrote:
> Handle single chunk writev as normal write.
> From some test more than 60% of the times writev is called with 1 as
> counter. We can easily and very cheaply turn this call to a simpler
> write avoiding the need to pass the array to the kernel.

Why not, but I'm unconvinced this is going to make any significant
difference ;)

> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/reds-stream.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/server/reds-stream.c b/server/reds-stream.c
> index a813a8b..84f2a7e 100644
> --- a/server/reds-stream.c
> +++ b/server/reds-stream.c
> @@ -304,7 +304,7 @@ ssize_t reds_stream_writev(RedsStream *s, const struct iovec *iov, int iovcnt)
>      int n;
>      ssize_t ret = 0;
>  
> -    if (s->priv->writev != NULL) {
> +    if (s->priv->writev != NULL && iovcnt > 1) {
>          return s->priv->writev(s, iov, iovcnt);
>      }
>  
> -- 
> 2.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170323/7f1a1fab/attachment.sig>


More information about the Spice-devel mailing list