From: Jia Rao Subject: Re: Re: how to change the memory size of a VM Date: Mon, 2 Nov 2009 16:37:35 -0500 Message-ID: <994429490911021337m39bbd0b3v3234f9e104bfe83a@mail.gmail.com> References: <994429490911021254i5c6435d6sb58aef31b5c8043b@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0343524462==" Return-path: In-Reply-To: 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 --===============0343524462== Content-Type: multipart/alternative; boundary=0015175cf86a946e8504776a2fa5 --0015175cf86a946e8504776a2fa5 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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 dynamically > removed from the guest. Then when Xen tells the balloon driver to take > memory, the guest decides which pages of memory to give away (thinking th= at > it is giving the memory to an especially hungry device driver). Google f= or > "balloon driver" for more info on how this works on Xen, VMware, other VM= Ms. > > If you are interested in much more detail on this, google for > "self-ballooning 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 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 no= t >> 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*(s= elf) > > > 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 > > > --0015175cf86a946e8504776a2fa5 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Thanks for the reply,
I am using xen 3.3 and linux-2.6.18.8.
I did no= t configure the guest to use balloon driver.
Is the balloon driver enabl= ed by default?

On Mon, Nov 2, 2009 at 4:3= 1 PM, Dan Magenheimer <dan.magenheimer@oracle.com> wrote:
There=20 must be a balloon driver in the guest for memory to be dynamically removed = from=20 the guest.=A0=A0Then when Xen=A0tells the balloon driver to take=20 memory,=A0the guest decides which pages of memory to give away (thinking th= at=20 it is giving the memory to an especially hungry device driver).=A0 Google f= or=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-ballo= oning Xen"=20 and "transcendent memory".
-----Ori= ginal Message-----
From: Jia Rao=20 [mailto:rickenra= o@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 changed = 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 tel= l=20 which are the 1024M byte that will be taken away (I do not want the xen= to=20 take the memory spaces that are caching useful data).

The comman= d for=20 memory size reconfiguration is "xm mem-set", so I looked the = source code of=20 xm.
It turned out to be the following python=20 calls:

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

=A0=A0 tools/python/xen/xend/XendDomainInfo.py:=20 _safe_set_memory
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=20 self.info[=91memory_dy= namic_min=92] =3D=20 target
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=20 self.info[=91memory_dy= namic_max=92] =3D=20 target

It seems that to change the memory size of a VM, you just n= eed=20 to save the new size in somewhere, xenstore?
How would the new size ta= ke=20 effect? the memory mapping of the VM must be modified somewhere.

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


=

--0015175cf86a946e8504776a2fa5-- --===============0343524462== 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 --===============0343524462==--