[libvirt] [PATCH] get memory in openvz driver
Evgeniy Sokolov
evg at openvz.org
Thu Aug 14 15:52:16 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.
Good idea! 5 setting for low memory + application
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'
Oomguarpages & Privvmpages & vmguarpages are settings for apps memory.
We may
1 set 'memory' to 'privvmpages' - then free will show correct value.
2 set 'memory' to 'vmguarpages' or 'oomguardpages' and
'maxmemory' to 'privvmpages'.
What do 'MaxMemory' mean for other libvirt drivers?
Bad point of it, for example:
We can set many of Oomguarpages & Privvmpages & vmguarpages but
application can not start because of 'kmemsize' is over.
>
> Daniel
More information about the libvir-list
mailing list