From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N6BtB-0000VL-NA for qemu-devel@nongnu.org; Thu, 05 Nov 2009 18:37:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N6Bt7-0000TX-1f for qemu-devel@nongnu.org; Thu, 05 Nov 2009 18:37:13 -0500 Received: from [199.232.76.173] (port=40393 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N6Bt6-0000TU-SF for qemu-devel@nongnu.org; Thu, 05 Nov 2009 18:37:08 -0500 Received: from e34.co.us.ibm.com ([32.97.110.152]:50833) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N6Bt6-0002YV-E0 for qemu-devel@nongnu.org; Thu, 05 Nov 2009 18:37:08 -0500 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e34.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id nA5NW8Va031878 for ; Thu, 5 Nov 2009 16:32:08 -0700 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nA5NauEm122430 for ; Thu, 5 Nov 2009 16:36:57 -0700 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id nA5Naqa7030001 for ; Thu, 5 Nov 2009 16:36:53 -0700 Message-ID: <4AF36194.7010500@us.ibm.com> Date: Thu, 05 Nov 2009 17:36:52 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1257461425.3121.22.camel@aglitke> In-Reply-To: <1257461425.3121.22.camel@aglitke> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [RFC] virtio: Report new guest memory statistics pertinent to memory ballooning List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: agl@linux.vnet.ibm.com Cc: qemu-devel@nongnu.org agl@linux.vnet.ibm.com wrote: > [RFC] virtio: Report new guest memory statistics pertinent to memory ballooning > > 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 to the host via the device config space. > > This patch implements the qemu side of the communication channel. I will post > the kernel driver modifications in-reply to this message. > > I'd like to pose a few questions concerning my implementation: > > * Is there a better way to use feature codes than using one per variable? > I think it's the right granularity personally. > * This patch causes the 'info balloon' monitor command to generate output like > the following: > > (qemu) info balloon > balloon: actual=1024 MB > balloon: pswapin=0 pages > balloon: pswapout=0 pages > balloon: panon=3928 KB > balloon: pgmajfault=0 > balloon: pgminfault=247914 > balloon: memfree=987032 KB > balloon: memtot=1020812 KB > We could probably use less obscure names for these stats like total_memory. I know we're facing a global shortage of bits but I think this is excessive conservation :-) We typically print these out as: balloon: actual=1024,pswapin=0,pswapout=0,panon=3928... It's a bit less readable admittedly, but it's how things tend to work. > > Is this agreeable? > > Thank you for your comments... > > Signed-off-by: Adam Litke \ > The indent is pretty strange here. git-send-email should help. > diff --git a/balloon.h b/balloon.h > index 60b4a5d..3f67021 100644 > --- a/balloon.h > +++ b/balloon.h > @@ -14,14 +14,21 @@ > #ifndef _QEMU_BALLOON_H > #define _QEMU_BALLOON_H > > +#include "hw/virtio-balloon.h" > #include "cpu-defs.h" > > -typedef ram_addr_t (QEMUBalloonEvent)(void *opaque, ram_addr_t target); > +struct QEMUBalloonState { > + ram_addr_t actual; > + struct virtio_balloon_stats stats; > +}; > We like to typedef the struct away from structures in qemu. See CodingStyle. The rest looks good. -- Regards, Anthony Liguori