From: Jia Rao Subject: Re: how to change the memory size of a VM Date: Mon, 2 Nov 2009 15:54:07 -0500 Message-ID: <994429490911021254i5c6435d6sb58aef31b5c8043b@mail.gmail.com> References: <994429490911021242x476ce517l34b3aa5db2a3157@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0067917827==" Return-path: In-Reply-To: <994429490911021242x476ce517l34b3aa5db2a3157@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: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============0067917827== Content-Type: multipart/alternative; boundary=0015175cf86a24463c047769942f --0015175cf86a24463c047769942f Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable > > I am looking into a problem that when the memory size of a VM is changed > 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 looked > 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: 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) 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 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 here ^_^ Thanks in advance --0015175cf86a24463c047769942f Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable

I am looking into a problem that when the memory size of = a VM is changed 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 looked the source code of xm.
It turned out to be the following pyt= hon calls:

tools/python/xen/xm/main.py: setMemoryTarget(dom, = mem_target)
=A0
tools/python/xen/xend/XendDomainInfo.py: setMemoryTarget: =A0=A0=A0=A0=A0= =A0=A0
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 self._safe_set_memory(= 'memory_dynamic_min', target * MiB)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 self._safe_set_memory(= 9;memory_dynamic_max', target * MiB)
=A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0=A0 xen.xend.XendDomain.instance().managed_config= _save(self)

=A0=A0 tools/python/xen/xend/XendDomainI= nfo.py: _safe_set_memory
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 self.info[=91memory_dynamic_min=92] =3D target
=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 self.info= [=91memory_dynamic_max=92] =3D target

It seems that to change th= e memory size of a VM, you just need to save the new size in somewhere, xen= store?
How would the new size take effect? the memory mapping of the VM must be mo= dified somewhere.

Look forward to replies, sorry if the question is = stupid, a newbie here ^_^
Thanks in advance


--0015175cf86a24463c047769942f-- --===============0067917827== 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 --===============0067917827==--