aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-02-14 13:18:04 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-03-19 22:25:36 +0100
commit645b757df77b2f85028e16c2e303b288fe2474af (patch)
tree840e57660fc100955602b1a77e21f781467f080d
parent074646707400ff659909fff1f059f58f44493a38 (diff)
downloadnx-libs-645b757df77b2f85028e16c2e303b288fe2474af.tar.gz
nx-libs-645b757df77b2f85028e16c2e303b288fe2474af.tar.bz2
nx-libs-645b757df77b2f85028e16c2e303b288fe2474af.zip
os: Immediately queue initial WriteToClient
Backported from X.org: commit 9bf46610a9d20962854016032de4567974e87957 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri Jun 21 22:58:31 2013 +0100 os: Immediately queue initial WriteToClient If we immediately put the WriteToClient() buffer into the socket's write queue, not only do we benefit from sending the response back to client earlier, but we also avoid the overhead of copying the data into our own staging buffer and causing extra work in the next select(). The write is effectively free as typically we may only send one reply per client per select() call, so the cost of the FlushClient() is the same. shmget10: 26400 -> 110000 getimage10: 25000 -> 108000 shmget500: 3160 -> 13500 getimage500: 1000 -> 1010 The knock-on effect is that on a mostly idle composited desktop, the CPU overhead is dominated by the memmove in WriteToClient, which is in turn eliminated by this patch. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
-rw-r--r--nx-X11/programs/Xserver/os/io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/nx-X11/programs/Xserver/os/io.c b/nx-X11/programs/Xserver/os/io.c
index 92a3f0476..a02d7fb0c 100644
--- a/nx-X11/programs/Xserver/os/io.c
+++ b/nx-X11/programs/Xserver/os/io.c
@@ -958,7 +958,7 @@ WriteToClient (ClientPtr who, int count, const void *__buf)
}
}
#endif
- if (oco->count + count + padBytes > oco->size)
+ if (oco->count == 0 || oco->count + count + padBytes > oco->size)
{
FD_CLR(oc->fd, &OutputPending);
if(!XFD_ANYSET(&OutputPending)) {