[Spice-devel] [PATCH v2 4/4] worker: don't do too much polling

Frediano Ziglio fziglio at redhat.com
Wed Feb 3 11:48:25 CET 2016


Now that processing is correctly restored there is no need to keep
polling to avoid main loop hangs. Reduce the polling count to 1
(just try once).
This reduce cpu usage if guests are mainly idle.
If you consider 100 guests waiting to login with cursor blinking
and considering the polling was done 200 times every 10ms (maximum)
just the cursor blinking was causing 10100 loop iterations per second
while now only 200 are needed (considering cursor blinking every
second).

Signed-by: Frediano Ziglio <figlio at redhat.com>
---
 server/red-worker.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/red-worker.c b/server/red-worker.c
index 45a597f..666c4b4 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -53,7 +53,7 @@
 #include "tree.h"
 
 #define CMD_RING_POLL_TIMEOUT 10 //milli
-#define CMD_RING_POLL_RETRIES 200
+#define CMD_RING_POLL_RETRIES 1
 
 #define INF_EVENT_WAIT ~0
 
-- 
2.4.3



More information about the Spice-devel mailing list