]> git.proxmox.com Git - qemu.git/commitdiff
net: use socket_set_nodelay() for -netdev socket
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 27 Feb 2013 14:05:47 +0000 (15:05 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 25 Mar 2013 10:13:09 +0000 (11:13 +0100)
Reduce -netdev socket latency by disabling the Nagle algorithm on
SOCK_STREAM sockets in net/socket.c.  Since we are tunelling Ethernet
over TCP we shouldn't artificially delay outgoing packets, let the guest
decide packet scheduling.

I already get sub-millisecond -netdev socket ping times on localhost, so
there was no measurable difference in my testing.  This won't hurt
though and may improve remote socket performance.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
net/socket.c

index d8b35a23cb3af7a33ac5c81b4aa8296bd0ce02c7..b0c83e022c31229ac52fc438c76b1cccbc7f3868 100644 (file)
@@ -438,6 +438,9 @@ static NetSocketState *net_socket_fd_init_stream(NetClientState *peer,
     s->fd = fd;
     s->listen_fd = -1;
 
+    /* Disable Nagle algorithm on TCP sockets to reduce latency */
+    socket_set_nodelay(fd);
+
     if (is_connected) {
         net_socket_connect(s);
     } else {