From: Jia Rao Subject: Re: How does the self-ballooning daemon calculate the selftarget? Date: Tue, 10 Nov 2009 20:21:30 -0500 Message-ID: <994429490911101721n652dc56et81d3563768c3cab0@mail.gmail.com> References: <994429490911101118o6e652f73re8fd6975b007d050@mail.gmail.com> <66b1e708-d301-4889-b530-1d24a03c92a2@default> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1331425822==" Return-path: In-Reply-To: <66b1e708-d301-4889-b530-1d24a03c92a2@default> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dan Magenheimer Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1331425822== Content-Type: multipart/alternative; boundary=000e0cd1e2221a187a04780e3f66 --000e0cd1e2221a187a04780e3f66 Content-Type: text/plain; charset=ISO-8859-1 Hi Dan, That is because the bug you mentioned here. I ran my guest under my friend's xen 3.4 which has a updated 2.6.18.8 dom0, the self ballooning worked fine (I didnt patch the guest kernel). I am going to patch the fix by Ian Campbell in my xen 3.3 machines. Do I need to patch the guest kernel too? or just patch the dom0 kernel? Thanks, Jia On Tue, Nov 10, 2009 at 3:45 PM, Dan Magenheimer wrote: > Hi Jia -- > > First, please note that when XENBALLOON_MINMEM is set to 0, that does NOT > mean 0MB. As described in the text in the xenballoon config > file, XENBALLOON_MINMEM==0 means that the heuristic is used which is in my > previous reply. > > 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 > updated 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 > encourage you to try tmem, which is in xen-unstable and the Oracle VM 2.2 > product. (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 > the 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 > utilization of a guest. In my case, the guest stays in idle for several > hours, the 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 > updated by a kernel thread kscand, which seems to has been removed from the > 2.6 kernel. > > 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 > might 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 < > dan.magenheimer@oracle.com> 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 >> selftarget for the guest OS. >> >From the README of balloon driver, it seems that selftarget is determined >> 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/balloon. >> The configuration of xenballoond.conf is the default except that I enabled >> 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 memory >> from the guest although the Committed_AS is small. The self-ballooning did >> changed the selftarget to something like 1.6GB but quickly changed to and >> fix at 193xxxxKB. >> >> According to the meminfo, we should be able to give up at least 800MB back >> to the VMM. >> FYI: xen 3.3.1, linux 2.6.18.8 in both dom0 and domu. >> >> Any ideas? >> >> Thanks, >> Jia >> > > --000e0cd1e2221a187a04780e3f66 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Dan,

That is because the bug you mentioned here. I ran my guest u= nder my friend's xen 3.4 which has a updated 2.6.18.8 dom0, the self ba= llooning worked fine (I didnt=A0 patch the guest kernel).

I am goin= g to patch the fix by Ian Campbell in my xen 3.3 machines.
Do I need to patch the guest kernel too? or just patch the dom0 kernel?
= Thanks,
Jia

On Tue, Nov 10, 2009 at 3:= 45 PM, Dan Magenheimer <dan.magenheimer@oracle.com> wrote:
Hi Jia=20 --
= =A0
First,=20 please note that when XENBALLOON_MINMEM is set to 0, that does NOT mean=20 0MB.=A0 As described in the text in the xenballoon config=20 file,=A0XENBALLOON_MINMEM=3D=3D0 means that the heuristic is used which is = in my=20 previous reply.

As f= or Committed_AS,=20 it is certainly not a perfect metric.=A0 It was just an adequate one (and= =20 much better than no metric at all).

I'm no= t sure, but your observation of meminfo not being periodically=20 updated may be a result of a balloon driver bug that was fixed in a patch b= y Ian=20 Campbell here:
= =A0
= =A0
If you=20 are interested in the area of memory utilization optimization, I'd enco= urage you=20 to try tmem, which is in xen-unstable and the Oracle VM 2.2 product.=A0 (Se= e=20 http://os= s.oracle.com/projects/tmem=20 for more info.)
= =A0
Dan
= =A0
P.S.=20 The minimum memory heuristic patch for the balloon driver=A0is=20 here:
= =A0
-----Original Message-----
From: Jia Rao=20 [mailto:rickenra= o@gmail.com]
Sent: Tu= esday, November 10, 2009 12:19=20 PM
To: Dan Magenheimer
Cc:=20 xen-de= vel@lists.xensource.com
Subject: Re: [Xen-devel] How does the= =20 self-ballooning daemon calculate the selftarget?

Hi=20 Dan,

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

I am wondering if the /proc/meminfo is a reliable source for= =20 memory utilization of a guest. In my case, the guest stays in idle for se= veral=20 hours, the metrics in /proc/meminfo is seldom changed.
For example, th= e=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 memin= fo is=20 correctly updated if the memory demand from the guest is increasing. Howe= ver,=20 once the memory demand drops or be almost zero (idle), the meminfo is not= =20 periodically updated. This might be a problem for the self-balloon daemon= 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 driver= =20 to
ensure that ballooning does not take too much memory away
from= 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 a= n=20 "old" balloon
driver and one changes certain parametersin the=20 scripts, kernel crashes might occur. =A0So the
self-ballooning scrip= ts=20 implement a minimum memory
algorithm similar to the newer balloon dr= iver=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 [mailto:rickenrao@gmail.com]
= Sent: Tuesday,=20 November 10, 2009 9:23 AM
To: xen-devel@lists.xensource.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 selftarget = 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 enabled= =20 self-balloon.

The following is the meminfo

MemTotal: =A0= =20 =A0 =A01939996 kB
MemFree: =A0 =A0 =A0 1183888=20 kB
Buffers: =A0 =A0 =A0 =A0 13260 kB
Cached: =A0 =A0=20 =A0 =A0 396492 kB
SwapCached: =A0 =A0 =A0 =A0 =A00=20 kB
Active: =A0 =A0 =A0 =A0 386912 kB
Inactive: =A0=20 =A0 =A0 213584 kB
HighTotal: =A0 =A0 =A0 =A0 =A0 0=20 kB
HighFree: =A0 =A0 =A0 =A0 =A0 =A00 kB
LowTotal:=20 =A0 =A0 =A01939996 kB
LowFree: =A0 =A0 =A0 1183888=20 kB
SwapTotal: =A0 =A0 2097136 kB
SwapFree: =A0 =A0=20 =A02097132 kB
Dirty: =A0 =A0 =A0 =A0 =A0 78432=20 kB
Writeback: =A0 =A0 =A0 =A0 =A0 0 kB
AnonPages:=20 =A0 =A0 =A0190668 kB
Mapped: =A0 =A0 =A0 =A0=20 =A014228 kB
Slab: =A0 =A0 =A0 =A0 =A0 =A053148=20 kB
PageTables: =A0 =A0 =A0 4836 kB
NFS_Unstable: =A0=20 =A0 =A0 =A00 kB
Bounce: =A0 =A0 =A0 =A0 =A0=20 =A0 =A00 kB
CommitLimit: =A0 3067132 kB
Committed_AS: =A0=20 524484 kB
VmallocTotal: 34359738367 kB
VmallocUsed: =A0 =A0=20 =A01208 kB
VmallocChunk: 34359737159 kB

It seems that the=20 self-balloon driver is reluctant to give up free memory from the guest= =20 although the Committed_AS is small. The self-ballooning did changed the= =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 u= p at=20 least 800MB back to the VMM.
FYI: xen 3.3.1, linux 2.6.18.8 in both = dom0=20 and domu.

Any=20 ideas?

Thanks,
Jia

=

--000e0cd1e2221a187a04780e3f66-- --===============1331425822== 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 --===============1331425822==--