From: Dan Magenheimer Subject: RE: How does the self-ballooning daemon calculate the selftarget? Date: Tue, 10 Nov 2009 12:45:04 -0800 (PST) Message-ID: <66b1e708-d301-4889-b530-1d24a03c92a2@default> References: <994429490911101118o6e652f73re8fd6975b007d050@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1621219557==" Return-path: In-Reply-To: <994429490911101118o6e652f73re8fd6975b007d050@mail.gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jia Rao Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1621219557== Content-Type: multipart/alternative; boundary="__125788594037015731abhmt012.oracle.com" --__125788594037015731abhmt012.oracle.com Content-Type: text/plain; charset=Windows-1252 Content-Transfer-Encoding: quoted-printable Hi Jia -- First, please note that when XENBALLOON_MINMEM is set to 0, that does NOT m= ean 0MB. As described in the text in the xenballoon config file, XENBALLOO= N_MINMEM=3D=3D0 means that the heuristic is used which is in my previous re= ply. As for Committed_AS, it is certainly not a perfect metric. It was just an = adequate one (and much better than no metric at all). I'm not sure, but your observation of meminfo not being periodically update= d may be a result of a balloon driver bug that was fixed in a patch by Ian = Campbell here: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/329ea0ccb344 If you are interested in the area of memory utilization optimization, I'd e= ncourage you to try tmem, which is in xen-unstable and the Oracle VM 2.2 pr= oduct. (See http://oss.oracle.com/projects/tmem for more info.) Dan P.S. The minimum memory heuristic patch for the balloon driver is here: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/b61443b1bf76 -----Original Message----- From: Jia Rao [mailto:rickenrao@gmail.com] Sent: Tuesday, November 10, 2009 12:19 PM To: Dan Magenheimer Cc: xen-devel@lists.xensource.com Subject: Re: [Xen-devel] How does the self-ballooning daemon calculate th= e selftarget? Hi Dan, Thanks for the reply. The XENBALLOON_MINMEM was set to 0 in my case. I am wondering if the /proc/meminfo is a reliable source for memory utili= zation of a guest. In my case, the guest stays in idle for several hours, t= he metrics in /proc/meminfo is seldom changed. For example, the Committed_AS and Active metrics stay almost the same for= several hours. In earlier kernels, the Active and Inactive metrics are periodically upda= ted by a kernel thread kscand, which seems to has been removed from the 2.6= kernel.=20 From what I have observed, the meminfo is correctly updated if the memory= demand from the guest is increasing. However, once the memory demand drops= or be almost zero (idle), the meminfo is not periodically updated. This mi= ght be a problem for the self-balloon daemon to deflate the balloon. Thanks, Jia On Tue, Nov 10, 2009 at 12:43 PM, Dan Magenheimer wrote: Hi Jia -- There are changes in newer versions of the balloon driver to ensure that ballooning does not take too much memory away from the kernel, which would result in kernel crashes. These changes set a different minimum value depending on how much memory the kernel originally discovered. If the self-ballooning scripts run with an "old" balloon driver and one changes certain parameters in the scripts, kernel crashes might occur. So the self-ballooning scripts implement a minimum memory algorithm similar to the newer balloon driver to avoid this situation. Look for XENBALLOON_MINMEM in the xenballoon config file if you want to change this. Dan -----Original Message----- From: Jia Rao [mailto:rickenrao@gmail.com] Sent: Tuesday, November 10, 2009 9:23 AM To: xen-devel@lists.xensource.com Subject: [Xen-devel] How does the self-ballooning daemon calculate the = selftarget? Hi all, I am wondering how does the self-ballooning daemon calculate the selfta= rget for the guest OS. >From the README of balloon driver, it seems that selftarget is determi= ned by Committed_AS in meminfo. I did some test on tpcc benchmark. the OS is initially allocated 2048MB= of memory, and then I enabled the selfballooning by echo 1 > /proc/xen/bal= loon. The configuration of xenballoond.conf is the default except that I enab= led self-balloon. The following is the meminfo MemTotal: 1939996 kB MemFree: 1183888 kB Buffers: 13260 kB Cached: 396492 kB SwapCached: 0 kB Active: 386912 kB Inactive: 213584 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 1939996 kB LowFree: 1183888 kB SwapTotal: 2097136 kB SwapFree: 2097132 kB Dirty: 78432 kB Writeback: 0 kB AnonPages: 190668 kB Mapped: 14228 kB Slab: 53148 kB PageTables: 4836 kB NFS_Unstable: 0 kB Bounce: 0 kB CommitLimit: 3067132 kB Committed_AS: 524484 kB VmallocTotal: 34359738367 kB VmallocUsed: 1208 kB VmallocChunk: 34359737159 kB It seems that the self-balloon driver is reluctant to give up free memo= ry from the guest although the Committed_AS is small. The self-ballooning d= id changed the selftarget to something like 1.6GB but quickly changed to an= d fix at 193xxxxKB. According to the meminfo, we should be able to give up at least 800MB b= ack to the VMM. FYI: xen 3.3.1, linux 2.6.18.8 in both dom0 and domu. Any ideas? Thanks, Jia --__125788594037015731abhmt012.oracle.com Content-Type: text/html; charset=Windows-1252 Content-Transfer-Encoding: quoted-printable
Hi Jia=20 --
 
First,=20 please note that when XENBALLOON_MINMEM is set to 0, that does NOT mean=20 0MB.  As described in the text in the xenballoon config=20 file, XENBALLOON_MINMEM=3D=3D0 means that the heuristic is used whic= h is in my=20 previous reply.

As for C= ommitted_AS,=20 it is certainly not a perfect metric.  It was just an adequate one (= and=20 much better than no metric at all).

I'm not sure, but your observation of meminfo not being periodic= ally=20 updated may be a result of a balloon driver bug that was fixed in a patch= by Ian=20 Campbell here:
 
http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/329ea0ccb344
 
If you=20 are interested in the area of memory utilization optimization, I'd encour= age you=20 to try tmem, which is in xen-unstable and the Oracle VM 2.2 product. = ; (See=20 http://oss.oracle.com/projec= ts/tmem=20 for more info.)
 
Dan
 
P.S.=20 The minimum memory heuristic patch for the balloon driver is=20 here:
 
http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/b61443b1bf76
-----Original Message-----
From: Jia Rao=20 [mailto:rickenrao@gmail.com]
Sent: Tuesday, November 10, 2009= 12:19=20 PM
To: Dan Magenheimer
Cc:=20 xen-devel@lists.xensource.com
Subject: Re: [Xen-devel] How do= es the=20 self-ballooning daemon calculate the selftarget?

Hi= =20 Dan,

Thanks for the reply.
The XENBALLOON_MINMEM was set to 0= in my=20 case.

I am wondering if the /proc/meminfo is a reliable source f= or=20 memory utilization of a guest. In my case, the guest stays in idle for = several=20 hours, the metrics in /proc/meminfo is seldom changed.
For example, = the=20 Committed_AS and Active metrics stay almost the same for several=20 hours.

In earlier kernels, the Active and Inactive metrics are=20 periodically updated by a kernel thread kscand, which seems to has been= =20 removed from the 2.6 kernel.

From what I have observed, the mem= info is=20 correctly updated if the memory demand from the guest is increasing. Ho= wever,=20 once the memory demand drops or be almost zero (idle), the meminfo is n= ot=20 periodically updated. This might be a problem for the self-balloon daem= on to=20 deflate the balloon.

Thanks,
Jia

On Tue, Nov 10, 2009 at 12:43 PM, Dan Magenhei= mer <dan.magenheimer@oracle.com>=20 wrote:
Hi=20 Jia --

There are changes in newer versions of the balloon driv= er=20 to
ensure that ballooning does not take too much memory away
fr= om the=20 kernel, which would result in kernel crashes.
These changes set a=20 different minimum value depending on
how much memory the kernel=20 originally discovered.

If the self-ballooning scripts run with= an=20 "old" balloon
driver and one changes certain parameters
in the=20 scripts, kernel crashes might occur.  So the
self-ballooning = scripts=20 implement a minimum memory
algorithm similar to the newer balloon = driver=20 to
avoid this situation.

Look for XENBALLOON_MINMEM in the=20 xenballoon config file
if you want to change this.

Dan

-----Original Message-----
From: Jia Rao [mail= to:rickenrao@gmail.com]
Sent:= Tuesday,=20 November 10, 2009 9:23 AM
To: xen-devel@lists.xensour= ce.com
Subject:=20 [Xen-devel] How does the self-ballooning daemon calculate the=20 selftarget?


Hi all,

I am wondering how does the=20 self-ballooning daemon calculate the selftarget for the guest=20 OS.
>From the README of balloon driver, it seems that selftarge= t is=20 determined by Committed_AS in meminfo.

I did some test on tpcc= =20 benchmark. the OS is initially allocated 2048MB of memory, and then I= =20 enabled the selfballooning by echo 1 > /proc/xen/balloon.
The=20 configuration of xenballoond.conf is the default except that I enable= d=20 self-balloon.

The following is the meminfo

MemTotal: &n= bsp;=20    1939996 kB
MemFree:       1183888=20 kB
Buffers:         13260 kB
Cached:  =  =20     396492 kB
SwapCached:         &n= bsp;0=20 kB
Active:         386912 kB
Inactive: &nbs= p;=20     213584 kB
HighTotal:         &nb= sp; 0=20 kB
HighFree:            0 kB
LowT= otal:=20      1939996 kB
LowFree:       11838= 88=20 kB
SwapTotal:     2097136 kB
SwapFree:    =20  2097132 kB
Dirty:           78432=20 kB
Writeback:           0 kB
AnonPages= :=20      190668 kB
Mapped:        =20  14228 kB
Slab:            5314= 8=20 kB
PageTables:       4836 kB
NFS_Unstable:  = ;=20      0 kB
Bounce:          = ;=20    0 kB
CommitLimit:   3067132 kB
Committed_AS: =  =20 524484 kB
VmallocTotal: 34359738367 kB
VmallocUsed:   &nbs= p;=20  1208 kB
VmallocChunk: 34359737159 kB

It seems that th= e=20 self-balloon driver is reluctant to give up free memory from the gues= t=20 although the Committed_AS is small. The self-ballooning did changed t= he=20 selftarget to something like 1.6GB but quickly changed to and fix at=20 193xxxxKB.

According to the meminfo, we should be able to give= up at=20 least 800MB back to the VMM.
FYI: xen 3.3.1, linux 2.6.18.8 in bot= h dom0=20 and domu.

Any=20 ideas?

Thanks,
Jia

--__125788594037015731abhmt012.oracle.com-- --===============1621219557== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1621219557==--