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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]