summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-21 22:58:31 +0100
committerAdam Jackson <ajax@redhat.com>2013-09-10 13:26:25 -0400
commit9bf46610a9d20962854016032de4567974e87957 (patch)
treeee0097e275105b57cde60b78749c24d2ba2858e0 /os
parentceffb34774d44ada83cc1994d20c8d65b46bd555 (diff)
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>
Diffstat (limited to 'os')
-rw-r--r--os/io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/os/io.c b/os/io.c
index 0d980ab9f..d34bc39b7 100644
--- a/os/io.c
+++ b/os/io.c
@@ -814,7 +814,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)) {
CriticalOutputPending = FALSE;