summaryrefslogtreecommitdiffstats
path: root/vl.c
diff options
context:
space:
mode:
authorAdam Litke <agl@us.ibm.com>2010-01-26 14:17:35 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-26 17:08:03 -0600
commit625a5befc2e3200b396594f002218d235e375da5 (patch)
tree89b9362c879d319b5061424035e3dbead9555e70 /vl.c
parent940cc30d0d456781adcc48bf9f8c5582026d7983 (diff)
downloadhqemu-625a5befc2e3200b396594f002218d235e375da5.zip
hqemu-625a5befc2e3200b396594f002218d235e375da5.tar.gz
virtio: Add memory statistics reporting to the balloon driver
When using ballooning to manage overcommitted memory on a host, a system for guests to communicate their memory usage to the host can provide information that will minimize the impact of ballooning on the guests. The current method employs a daemon running in each guest that communicates memory statistics to a host daemon at a specified time interval. The host daemon aggregates this information and inflates and/or deflates balloons according to the level of host memory pressure. This approach is effective but overly complex since a daemon must be installed inside each guest and coordinated to communicate with the host. A simpler approach is to collect memory statistics in the virtio balloon driver and communicate them directly to the hypervisor. Signed-off-by: Adam Litke <agl@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/vl.c b/vl.c
index 5e8c775..1cd355c 100644
--- a/vl.c
+++ b/vl.c
@@ -365,17 +365,24 @@ void qemu_add_balloon_handler(QEMUBalloonEvent *func, void *opaque)
qemu_balloon_event_opaque = opaque;
}
-void qemu_balloon(ram_addr_t target)
+int qemu_balloon(ram_addr_t target, MonitorCompletion cb, void *opaque)
{
- if (qemu_balloon_event)
- qemu_balloon_event(qemu_balloon_event_opaque, target);
+ if (qemu_balloon_event) {
+ qemu_balloon_event(qemu_balloon_event_opaque, target, cb, opaque);
+ return 1;
+ } else {
+ return 0;
+ }
}
-ram_addr_t qemu_balloon_status(void)
+int qemu_balloon_status(MonitorCompletion cb, void *opaque)
{
- if (qemu_balloon_event)
- return qemu_balloon_event(qemu_balloon_event_opaque, 0);
- return 0;
+ if (qemu_balloon_event) {
+ qemu_balloon_event(qemu_balloon_event_opaque, 0, cb, opaque);
+ return 1;
+ } else {
+ return 0;
+ }
}
OpenPOWER on IntegriCloud