This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


RE: [Xen-devel] Re: how to change the memory size of a VM

To: Jia Rao <rickenrao@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: RE: [Xen-devel] Re: how to change the memory size of a VM
From: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
Date: Mon, 2 Nov 2009 13:31:21 -0800 (PST)
Delivery-date: Mon, 02 Nov 2009 13:34:08 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <994429490911021254i5c6435d6sb58aef31b5c8043b@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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 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 VMMs.

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@xxxxxxxxx]
Sent: Monday, November 02, 2009 1:54 PM
To: xen-devel@xxxxxxxxxxxxxxxxxxx
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 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)

   tools/python/xen/xend/XendDomainInfo.py: _safe_set_memory
                  self.info[‘memory_dynamic_min’] = target
                  self.info[‘memory_dynamic_max’] = 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

Xen-devel mailing list