[libvirt] [RFC] Memory controller exploitation in libvirt
Nikunj A. Dadhania
nikunj at linux.vnet.ibm.com
Tue Aug 24 10:59:30 UTC 2010
On Tue, 24 Aug 2010 10:59:52 +0100, "Daniel P. Berrange" <berrange at redhat.com> wrote:
> On Tue, Aug 24, 2010 at 11:53:27AM +0530, Nikunj A. Dadhania wrote:
> >
> > Subject: [RFC] Memory controller exploitation in libvirt
> >
> > Memory CGroup is a kernel feature that can be exploited effectively in the
> > current libvirt/qemu driver. Here is a shot at that.
> >
> > At present, QEmu uses memory ballooning feature, where the memory can be
> > inflated/deflated as and when needed, co-operatively between the host and
> > the guest. There should be some mechanism where the host can have more
> > control over the guests memory usage. Memory CGroup provides features such
> > as hard-limit and soft-limit for memory, and hard-limit for swap area.
>
> Exposing the tunables is nice, but there is another related problem.
> We don't provide apps enough information to effectively use them.
>
> eg, they configure a guest with 500 MB of RAM. How much RAM does
> QEMU actually use. 500 MB + X MB more. We need to give apps an
> indication of what the 'X' overhead is. Some of it comes from the
> video RAM. Some is pure QEMU emulation overhead.
Can we cover them in memory statistics API, ie, domainGetMemoryParameters with
parameter type MemoryUsage, MemoryOverhead?
> > * Might need to redefine(changing the scope) of existing memory
> > API. Currently, domainSetMemory is used to set limit_in_bytes in LXC and
> > memory ballooning in QEmu. While the domainSetMaxMemory is not defined in
> > QEmu and in case of LXC it is setting the internal object's maxmem
> > variable.
>
> Yep, might need to clarify LXC a little bit.
Sure, when domainSetMaxMemory is called in case of LXC, sets vm->def->maxmem
(vm is of type virDomainObjPtr and def is of type virDomainDefPtr) if the
newmaxmem is greater than current memory.
domainSetMemory for LXC: Sets the memory cgroup file memory.limit_in_bytes if
newmem being set is less than the maximum permissible VM
memory(vm->def->maxmem)
Nikunj
More information about the libvir-list
mailing list