[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/20] vnc: recycle empty vs->output buffer
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 16/20] vnc: recycle empty vs->output buffer |
Date: |
Mon, 16 Nov 2015 18:25:31 +0100 |
From: Peter Lieven <address@hidden>
If the vs->output buffer is empty it will be dropped
by the next qio_buffer_move_empty in vnc_jobs_consume_buffer
anyway. So reuse the allocated buffer from this buffer
in the worker thread where we otherwise would start with
an empty (unallocated buffer).
Signed-off-by: Peter Lieven <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
[ added a comment describing the non-obvious optimization ]
Signed-off-by: Gerd Hoffmann <address@hidden>
---
ui/vnc-jobs.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c
index 12389cc..08f0163 100644
--- a/ui/vnc-jobs.c
+++ b/ui/vnc-jobs.c
@@ -235,6 +235,14 @@ static int vnc_worker_thread_loop(VncJobQueue *queue)
vnc_unlock_output(job->vs);
goto disconnected;
}
+ if (buffer_empty(&job->vs->output)) {
+ /*
+ * Looks like a NOP as it obviously moves no data. But it
+ * moves the empty buffer, so we don't have to malloc a new
+ * one for vs.output
+ */
+ buffer_move_empty(&vs.output, &job->vs->output);
+ }
vnc_unlock_output(job->vs);
/* Make a local copy of vs and switch output buffers */
--
1.8.3.1
- [Qemu-devel] [PULL for-2.5 00/20] vnc: buffer code improvements, bugfixes., Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 13/20] vnc: use vnc_{width, height} in vnc_set_area_dirty, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 01/20] buffer: make the Buffer capacity increase in powers of two, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 09/20] vnc-jobs: move buffer reset, use new buffer move, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 04/20] buffer: add buffer_move, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 10/20] vnc: zap dead code, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 06/20] buffer: add tracing, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 08/20] vnc: kill jobs queue buffer, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 02/20] buffer: add buffer_init, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 18/20] buffer: factor out buffer_adj_size, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 16/20] vnc: recycle empty vs->output buffer,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 19/20] buffer: allow a buffer to shrink gracefully, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 11/20] vnc: add vnc_width+vnc_height helpers, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 03/20] buffer: add buffer_move_empty, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 14/20] vnc: only alloc server surface with clients connected, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 05/20] buffer: add buffer_shrink, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 20/20] vnc: fix mismerge, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 07/20] vnc: attach names to buffers, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 17/20] buffer: factor out buffer_req_size, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 12/20] vnc: factor out vnc_update_server_surface, Gerd Hoffmann, 2015/11/16
- [Qemu-devel] [PULL 15/20] vnc: fix local state init, Gerd Hoffmann, 2015/11/16