qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] monitor: increase amount of data for monitor to read
@ 2019-06-10 10:59 Denis Plotnikov
  2019-07-03  6:36 ` Markus Armbruster
  0 siblings, 1 reply; 11+ messages in thread
From: Denis Plotnikov @ 2019-06-10 10:59 UTC (permalink / raw)
  To: dgilbert, armbru; +Cc: qemu-devel, den

Right now QMP and HMP monitors read 1 byte at a time from the socket, which
is very inefficient. With 100+ VMs on the host this easily reasults in
a lot of unnecessary system calls and CPU usage in the system.

This patch changes the amount of data to read to 4096 bytes, which matches
buffer size on the channel level. Fortunately, monitor protocol is
synchronous right now thus we should not face side effects in reality.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
---
 include/monitor/monitor.h | 2 +-
 monitor.c                 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index c1b40a9cac..afa1ed34a4 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -14,7 +14,7 @@ extern __thread Monitor *cur_mon;
 #define MONITOR_USE_CONTROL   0x04
 #define MONITOR_USE_PRETTY    0x08
 
-#define QMP_REQ_QUEUE_LEN_MAX 8
+#define QMP_REQ_QUEUE_LEN_MAX 4096
 
 bool monitor_cur_is_qmp(void);
 
diff --git a/monitor.c b/monitor.c
index 4807bbe811..a08e020b61 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4097,7 +4097,7 @@ static int monitor_can_read(void *opaque)
 {
     Monitor *mon = opaque;
 
-    return !atomic_mb_read(&mon->suspend_cnt);
+    return !atomic_mb_read(&mon->suspend_cnt) ? 4096 : 0;
 }
 
 /*
-- 
2.17.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-03-06  7:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-10 10:59 [Qemu-devel] [PATCH] monitor: increase amount of data for monitor to read Denis Plotnikov
2019-07-03  6:36 ` Markus Armbruster
2019-07-03  7:18   ` Denis Lunev
2019-07-10 16:36   ` Dr. David Alan Gilbert
2020-11-24 15:44     ` Vladimir Sementsov-Ogievskiy
2021-03-02 17:06       ` Vladimir Sementsov-Ogievskiy
2021-03-05 14:10         ` Markus Armbruster
2021-03-05 14:47           ` Vladimir Sementsov-Ogievskiy
2021-03-05 16:13             ` Markus Armbruster
2021-03-05 16:20               ` Vladimir Sementsov-Ogievskiy
2021-03-06  7:15                 ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).