From: Dan Magenheimer Subject: RE: Re: how to change the memory size of a VM Date: Mon, 2 Nov 2009 13:53:01 -0800 (PST) Message-ID: <5f8ee3ab-e30f-416d-8b0a-4dcb3d88ffb1@default> References: <994429490911021337m39bbd0b3v3234f9e104bfe83a@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1143039081==" Return-path: In-Reply-To: <994429490911021337m39bbd0b3v3234f9e104bfe83a@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 --===============1143039081== Content-Type: multipart/alternative; boundary="__125719879595223407abhmt008.oracle.com" --__125719879595223407abhmt008.oracle.com Content-Type: text/plain; charset=Windows-1252 Content-Transfer-Encoding: quoted-printable If by linux-2.6.18.8 you mean the default Xen-ified kernel from xen.org, ye= s, the balloon driver should be built by default. If you mean a kernel.org= 2.6.18.8 kernel running as a HVM (fully virtualized), no, the balloon driv= er will not be there by default. If you can type to a command line in your guest, if "cat /proc/xen/balloon"= works, the balloon driver is enabled in that guest. -----Original Message----- From: Jia Rao [mailto:rickenrao@gmail.com] Sent: Monday, November 02, 2009 2:38 PM To: Dan Magenheimer Cc: xen-devel@lists.xensource.com Subject: Re: [Xen-devel] Re: how to change the memory size of a VM Thanks for the reply, I am using xen 3.3 and linux-2.6.18.8. I did not configure the guest to use balloon driver. Is the balloon driver enabled by default? On Mon, Nov 2, 2009 at 4:31 PM, Dan Magenheimer wrote: There must be a balloon driver in the guest for memory to be dynamicall= y removed from the guest. Then when Xen tells the balloon driver to take m= emory, the guest decides which pages of memory to give away (thinking that = it is giving the memory to an especially hungry device driver). Google for= "balloon driver" for more info on how this works on Xen, VMware, other VMM= s. If you are interested in much more detail on this, google for "self-bal= looning Xen" and "transcendent memory". -----Original Message----- From: Jia Rao [mailto:rickenrao@gmail.com] Sent: Monday, November 02, 2009 1:54 PM To: xen-devel@lists.xensource.com Subject: [Xen-devel] Re: how to change the memory size of a VM I am looking into a problem that when the memory size of a VM is ch= anged which part of the original memory is taken away by xen. For example, if I change the memory size of a VM from 2048MB --> 10= 24MB, how can I tell which are the 1024M byte that will be taken away (I do= not want the xen to take the memory spaces that are caching useful data). The command for memory size reconfiguration is "xm mem-set", so I l= ooked the source code of xm. It turned out to be the following python calls: tools/python/xen/xm/main.py: setMemoryTarget(dom, mem_target) tools/python/xen/xend/XendDomainInfo.py: setMemoryTarget: = =20 self._safe_set_memory('memory_dynamic_min', target *= MiB) self._safe_set_memory('memory_dynamic_max', target *= MiB) xen.xend.XendDomain.instance().managed_config_save= (self)=20 tools/python/xen/xend/XendDomainInfo.py: _safe_set_memory self.info[=91memory_dynamic_min=92] =3D target self.info[=91memory_dynamic_max=92] =3D target It seems that to change the memory size of a VM, you just need to sav= e the new size in somewhere, xenstore? How would the new size take effect? the memory mapping of the VM must= be modified somewhere. Look forward to replies, sorry if the question is stupid, a newbie he= re ^_^ Thanks in advance --__125719879595223407abhmt008.oracle.com Content-Type: text/html; charset=Windows-1252 Content-Transfer-Encoding: quoted-printable
If by=20 linux-2.6.18.8 you mean the default Xen-ified kernel from xen.org, yes, t= he=20 balloon driver should be built by default.  If you mean a kernel.org= =20 2.6.18.8 kernel running as a HVM (fully virtualized), no, the balloon dri= ver=20 will not be there by default.
 
If you=20 can type to a command line in your guest, if "cat /proc/xen/balloon" work= s, the=20 balloon driver is enabled in that guest.
-----Original Message-----
From: Jia Rao=20 [mailto:rickenrao@gmail.com]
Sent: Monday, November 02, 2009 = 2:38=20 PM
To: Dan Magenheimer
Cc:=20 xen-devel@lists.xensource.com
Subject: Re: [Xen-devel] Re: ho= w to=20 change the memory size of a VM

Thanks for the reply= ,
I=20 am using xen 3.3 and linux-2.6.18.8.
I did not configure the guest t= o use=20 balloon driver.
Is the balloon driver enabled by default?

On Mon, Nov 2, 2009 at 4:31 PM, Dan Magenheime= r <dan.magenheimer@oracle.com>=20 wrote:
There must be = a balloon=20 driver in the guest for memory to be dynamically removed from the=20 guest.  Then when Xen tells the balloon driver to take= =20 memory, the guest decides which pages of memory to give away (th= inking=20 that it is giving the memory to an especially hungry device driver).&= nbsp;=20 Google for "balloon driver" for more info on how this works on Xen, V= Mware,=20 other VMMs.

If you are= interested=20 in much more detail on this, google for "self-ballooning Xen" and=20 "transcendent memory".
-----Origi= nal=20 Message-----
From: Jia Rao [mailto:rickenrao@gmail.com]
Sent: Monday, No= vember=20 02, 2009 1:54 PM
To: xen-devel@lists.xensource.com
Subject:=20 [Xen-devel] Re: how to change the memory size of a=20 VM



I=20 am looking into a problem that when the memory size of a VM is ch= anged=20 which part of the original memory is taken away by xen.
For ex= ample,=20 if I change the memory size of a VM from 2048MB --> 1024MB, ho= w can I=20 tell which are the 1024M byte that will be taken away (I do not w= ant the=20 xen to take the memory spaces that are caching useful data).
<= BR>The=20 command for memory size reconfiguration is "xm mem-set", so I loo= ked the=20 source code of xm.
It turned out to be the following python=20 calls:

tools/python/xen/xm/main.py: setMemoryTarget= (dom,=20 mem_target)
 
tools/python/xen/xend/XendDomainInfo.py:=20 setMemoryTarget:        
       &n= bsp;      =20 self._safe_set_memory('memory_dynamic_min', target *=20 MiB)
         &nb= sp;    =20 self._safe_set_memory('memory_dynamic_max', target *=20 MiB)
                 =  =20 xen.xend.XendDomain.instance().managed_config_save(self)

   tools/python/xen/xend/XendDomainInfo.py:=20 _safe_set_memory
      &nbs= p;          =20 self.info[=91memory_dynamic_min=92] =3D=20 target
         &nb= sp;       =20 self.info[=91memory_dynamic_max=92] =3D target<= BR>
It seems=20 that to change the memory size of a VM, you just need to save the n= ew size=20 in somewhere, xenstore?
How would the new size take effect? the = memory=20 mapping of the VM must be modified somewhere.

Look forward t= o=20 replies, sorry if the question is stupid, a newbie here ^_^
Than= ks in=20 advance



--__125719879595223407abhmt008.oracle.com-- --===============1143039081== 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 --===============1143039081==--