From: Dan Magenheimer Subject: RE: Re: how to change the memory size of a VM Date: Mon, 2 Nov 2009 13:31:21 -0800 (PST) Message-ID: References: <994429490911021254i5c6435d6sb58aef31b5c8043b@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0512768453==" Return-path: In-Reply-To: <994429490911021254i5c6435d6sb58aef31b5c8043b@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 , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============0512768453== Content-Type: multipart/alternative; boundary="__125719749616623930abhmt008.oracle.com" --__125719749616623930abhmt008.oracle.com Content-Type: text/plain; charset=Windows-1252 Content-Transfer-Encoding: quoted-printable There must be a balloon driver in the guest for memory to be dynamically re= moved from the guest. Then when Xen tells the balloon driver to take memor= y, the guest decides which pages of memory to give away (thinking that it i= s giving the memory to an especially hungry device driver). Google for "ba= lloon driver" for more info on how this works on Xen, VMware, other VMMs. If you are interested in much more detail on this, google for "self-balloon= ing 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 change= d which part of the original memory is taken away by xen. For example, if I change the memory size of a VM from 2048MB --> 1024MB= , 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 looke= d 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(sel= f)=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 save th= e 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 here ^= _^ Thanks in advance --__125719749616623930abhmt008.oracle.com Content-Type: text/html; charset=Windows-1252 Content-Transfer-Encoding: quoted-printable
There=20 must be a balloon driver in the guest for memory to be dynamically remove= d from=20 the guest.  Then when Xen tells the balloon driver to take= =20 memory, the guest decides which pages of memory to give away (thinki= ng that=20 it is giving the memory to an especially hungry device driver).  Goo= gle for=20 "balloon driver" for more info on how this works on Xen, VMware, other=20 VMMs.

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



I=20 am looking into a problem that when the memory size of a VM is change= d which=20 part of the original memory is taken away by xen.
For example, if = I=20 change the memory size of a VM from 2048MB --> 1024MB, how can I t= ell=20 which are the 1024M byte that will be taken away (I do not want the x= en to=20 take the memory spaces that are caching useful data).

The comm= and for=20 memory size reconfiguration is "xm mem-set", so I looked the source c= ode of=20 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:        
        =       =20 self._safe_set_memory('memory_dynamic_min', target *=20 MiB)
          &= nbsp;   =20 self._safe_set_memory('memory_dynamic_max', target *=20 MiB)
                 &nbs= p;=20 xen.xend.XendDomain.instance().managed_config_save(self)

   tools/python/xen/xend/XendDomainInfo.py:=20 _safe_set_memory
       &n= bsp;         =20 self.info[=91memory_dynamic_min=92] =3D= =20 target
          &= nbsp;      =20 self.info[=91memory_dynamic_max=92] =3D= =20 target

It seems that to change the memory size of a VM, you just= need=20 to save the new size in somewhere, xenstore?
How would the new size = take=20 effect? the memory mapping of the VM must be modified somewhere.
Look=20 forward to replies, sorry if the question is stupid, a newbie here=20 ^_^
Thanks in advance


--__125719749616623930abhmt008.oracle.com-- --===============0512768453== 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 --===============0512768453==--