[libvirt] [RFC] Memory controller exploitation in libvirt

Nikunj A. Dadhania nikunj at linux.vnet.ibm.com
Tue Aug 24 08:05:10 UTC 2010


On Tue, 24 Aug 2010 13:05:26 +0530, Balbir Singh <balbir at linux.vnet.ibm.com> wrote:
> * Nikunj A. Dadhania <nikunj at linux.vnet.ibm.com> [2010-08-24 11:53:27]:
> 
> > 
> >  Subject: [RFC] Memory controller exploitation in libvirt
> > 
> >  Corresponding libvirt public API:
> >  int virDomainSetMemoryParamters (virDomainPtr domain, 
> >      				  virMemoryParamterPtr params, 
> >       		                  unsigned int nparams);
> >  int virDomainGetMemoryParamters (virDomainPtr domain, 
> >      				  virMemoryParamterPtr params, 
> >       		                  unsigned int nparams);
> > 
> > 
> 
> Does nparams imply setting several parameters together? Does bulk
> loading help? I would prefer splitting out the API if possible
> into
Yes it helps, when parsing the parameters from the domain xml file, we can call
this API and set them at once. BTW, it can also be called with one parameter
if desired.

> 
>         virCgroupSetMemory() - already present in src/util/cgroup.c
>         virCgroupGetMemory() - already present in src/util/cgroup.c
>         virCgroupSetMemorySoftLimit()
>         virCgroupSetMemoryHardLimit()
>         virCgroupSetMemorySwapHardLimit()
>         virCgroupGetStats()
This is at the cgroup level(internal API) and will be implemented in the way
that is suggested. The RFC should not be specific to cgroups. libvirt is
supported on multiple OS and the above described APIs in the RFC are public
API.

> >     SwapHardLimits (memory.memsw_limit_in_bytes) - Maximum swap 
> >     SwapSoftLimits (Currently not supported by kernel) - Desired swap space 
> > 
> 
> We *dont* support SwapSoftLimits in the memory cgroup controller with
> no plans to support it in the future either at this point. The
Ok.

> >     Tunables memory.limit_in_bytes, memory.softlimit_in_bytes and
> >     memory.memsw_limit_in_bytes are provided by the memory controller in the
> >     Linux kernel.
> >     
> >  I am not an expert here, so just listing what new elements need to be added
> >  to the XML schema:
> > 
> >  <define name="resource">
> >     <element memory>
> >     	<element memoryHardLimit/>
> >     	<element memorySoftLimit/>
> >         <element memoryMinGaurantee/>
> >         <element swapHardLimit/>
> >         <element swapSoftLimit/>
> >     </element>
> >  </define>
> > 
> 
> I'd prefer a syntax that integrates well with what we currently have
> 
>         <cgroup>
>                 <path>...</path>
>                 <controller>
>                 <name>..</name>
>                 <soft limit>...</>
>                 <hard limit>...</>
>                 </controller>
>         ...
>         </cgroup>

Again this is a libvirt domain xml file, IMO, it should not be cgroup specific.

Nikunj




More information about the libvir-list mailing list