Daniel Goertzen
2006-Jan-21 17:53 UTC
[Xen-users] confusion over memory, maxmem, balloon, etc
My goal for my xen setup is to allow the dom0 and domU to "share" memory, meaning that occasionally one of the domains will hog ram for a short time and then relinquish it so it can be used for other domains. I get the impression that xen can handle this, but I''m having a hell of a time getting straight information. What does the "memory" parameter in a domU config file actually mean? Is this an amount of physical ram that is permanently reserved for the domU? Is this a minimum setting? Maximum setting? Is this the same parameter as dom0_mem param given to xen? What exactly is the role of the balloon driver? Is this always present in the xen linux kernel or do I have to do something to turn it on? Is it something I need to control? Does it behave the same in dom0 and domU kernels? What is the dom0_min_mem parameter? How is it set? Do domU''s have this too? When I type "xm list --long" I see a parameter called "maxmem". What does that mean? How is it set? I note that "xm list" will show maxmem as say 512, but "xm top" will show "no limit"??? I apologize for the barrage of questions, but the fragments of information I have been finding just leave me more confused and frustrated. Thanks, Dan. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Jeffrey I. Schiller
2006-Jan-21 18:53 UTC
Re: [Xen-users] confusion over memory, maxmem, balloon, etc
I won''t answer all of your questions, but I''ll tell you this. The memory parameter establishes the amount of member that domU believes it has. From what I can tell, once you boot domU it cannot use more memory then this (because this is all that the domU kernel knows about). Let''s say you set this to 512Mb so your domU kernel is using 512Mb. Suppose you want 128Mb back. Using the “xm” command in dom0 (in 2.0.7 it is the “balloon” subcommand and in 3.0 I believe it is “maxmem” [I''m not 100% on this because I don''t have the documentation handy, if you attempt to use “xm balloon” in 3.0 it will tell you the new command name!]) set the domain''s memory to 384Mb (512-128). What happens is that dom0 tells the domU''s kernel to reduce its memory usage. It does this my kmem alloc''ing 128Mb of memory (so the domU kernel thinks it is using this memory) and then handing the physical memory back to the hypervisor. So as far as the linux kernel is concerned in domU, there is this 128Mb “balloon” of memory that it cannot touch. In fact it isn''t there [and I suspect attempting to touch it will cause a fault]. When you give back the memory to domU, the balloon driver requests the memory from the hypervisor to fill in the balloon and then kmem free''s it. This makes it available again to domU. This all works the same way in dom0. So you can hand memory from dom0 to domU and back again... Hope this helps. -Jeff P.S. I am not a Xen developer, just a user [of 2.0.7 at the moment, playing with 3.0] who has read some source code :-) -- ============================================================================Jeffrey I. Schiller MIT Network Manager Information Services and Technology Massachusetts Institute of Technology 77 Massachusetts Avenue Room W92-190 Cambridge, MA 02139-4307 617.253.0161 - Voice jis@mit.edu =========================================================================== _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Daniel Goertzen
2006-Jan-21 22:36 UTC
Re: [Xen-users] confusion over memory, maxmem, balloon, etc
Thank you Jeffrey, that was a huge help. I have some device driver work under my belt so that all made perfect sense. I assume that the balloons are entirely under manual control at the moment, ie, you can''t get domains to pump up their balloons when nothing is going on? Cheers, Dan. Jeffrey I. Schiller wrote:>I won''t answer all of your questions, but I''ll tell you this. > >The memory parameter establishes the amount of member that domU believes >it has. From what I can tell, once you boot domU it cannot use more >memory then this (because this is all that the domU kernel knows about). > >Let''s say you set this to 512Mb so your domU kernel is using 512Mb. >Suppose you want 128Mb back. Using the “xm” command in dom0 (in 2.0.7 it >is the “balloon” subcommand and in 3.0 I believe it is “maxmem” [I''m not >100% on this because I don''t have the documentation handy, if you >attempt to use “xm balloon” in 3.0 it will tell you the new command >name!]) set the domain''s memory to 384Mb (512-128). What happens is that >dom0 tells the domU''s kernel to reduce its memory usage. It does this my >kmem alloc''ing 128Mb of memory (so the domU kernel thinks it is using >this memory) and then handing the physical memory back to the >hypervisor. So as far as the linux kernel is concerned in domU, there is >this 128Mb “balloon” of memory that it cannot touch. In fact it isn''t >there [and I suspect attempting to touch it will cause a fault]. > >When you give back the memory to domU, the balloon driver requests the >memory from the hypervisor to fill in the balloon and then kmem free''s >it. This makes it available again to domU. > >This all works the same way in dom0. > >So you can hand memory from dom0 to domU and back again... > >Hope this helps. > > -Jeff > >P.S. I am not a Xen developer, just a user [of 2.0.7 at the moment, >playing with 3.0] who has read some source code :-) > > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Jeffrey I. Schiller
2006-Jan-21 22:46 UTC
Re: [Xen-users] confusion over memory, maxmem, balloon, etc
Daniel Goertzen wrote:> I assume that the balloons are entirely under manual control at the > moment, ie, you can''t get domains to pump up their balloons when nothing > is going on?Don''t believe so. At least I don''t recall seeing any code that did that, but I wasn''t looking for it either. -Jeff -- ============================================================================Jeffrey I. Schiller MIT Network Manager Information Services and Technology Massachusetts Institute of Technology 77 Massachusetts Avenue Room W92-190 Cambridge, MA 02139-4307 617.253.0161 - Voice jis@mit.edu =========================================================================== _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users