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

Frediano Ziglio fziglio at redhat.com
Mon Mar 13 09:51:26 UTC 2017


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.

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



More information about the Spice-devel mailing list