[libvirt] [PATCH] get memory in openvz driver

Daniel P. Berrange berrange at redhat.com
Thu Aug 14 14:46:26 UTC 2008


On Thu, Aug 14, 2008 at 06:08:31PM +0400, Evgeniy Sokolov wrote:
> >On Wed, Aug 13, 2008 at 12:50:33PM +0400, Evgeniy Sokolov wrote:
> >>OpenVZ has several parameters for memory management. All of them can be 
> >>configured independetly.
> >
> >Summing all the different memory limits together is wrong - this will
> >make it impossible to implement a 'setMemory' operation because you've
> >now no way of deciding which parameter to set.
> It is correct calcuation of total memory.
> Because of non-obvious implenetation of 'setMemory', I have asked 'how 
> to manage memory' in begining.
> I propouse to set some portion of 'memory' to each limit.

I don't think that will be lead to good behaviour - ultimtely I think
we'll need to expose more (all?) of these memory settings directly as
tunable resources. THus for the 'memory' setting we which pick the
value which provides the primary memory size as available to apps
within the container.

> >
> >In my testing the total memory inside a OpenVZ container seems to 
> >correspond to the 'lockedpages' parameter, so we should just return
> >that value.
> How did you get total memory?
> Most big part of memory is oomguarpages (by default). Lockedpages is 
> about %1.

I've just found & read these descriptions...

  http://wiki.openvz.org/Oomguarpages#oomguarpages 
  http://wiki.openvz.org/Oomguarpages#privvmpages
  http://wiki.openvz.org/Vmguarpages#vmguarpages

To summarize 

    "Oomguarpages parameter accounts the total amount of memory and
     swap space used by the processes of a particular container.

    "Privvmpages parameter accounts allocated (but, possibly, not 
     used yet) memory. The accounted value is an estimation how 
     much memory will be really consumed when the container's 
     applications start to use the allocated memory. Consumed 
     memory is accounted into oomguarpages parameter

    "vmguarpages parameter controls how much memory is available to
     the Virtual Environment (i.e. how much memory its applications
     can allocate by malloc(3) or other standard Linux memory 
     allocation mechanisms"

    "The memory allocation guarantee (vmguarpages) is a primary tool
     for controlling the memory available to containers, because it
     allows administrators to provide Service Level Agreements"

So from those I'd think that 'vmguarpages'  maps best into libvirt's 
concept of 'memory'. Though perhaps 'oomguardpages' could be set for
'memory' and 'vmguarpages' used for 'max memory'

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list