[libvirt] [PATCH v3 04/13] XML parsing for memory tunables

Daniel P. Berrange berrange at redhat.com
Thu Oct 7 11:49:29 UTC 2010


On Mon, Oct 04, 2010 at 12:47:22PM +0530, Nikunj A. Dadhania wrote:
> On Mon, 4 Oct 2010 12:16:42 +0530, Balbir Singh <balbir at linux.vnet.ibm.com> wrote:
> > * Nikunj A. Dadhania <nikunj at linux.vnet.ibm.com> [2010-09-28 15:26:30]:
> <snip>
> > > +    /* Extract other memory tunables */
> > > +    if (virXPathULong("string(./memtune/hard_limit)", ctxt, 
> > > +                      &def->mem.hard_limit) < 0) 
> > > +        def->mem.hard_limit = 0;
> > > +    
> > > +    if (virXPathULong("string(./memtune/soft_limit[1])", ctxt, 
> > > +                      &def->mem.soft_limit) < 0)
> > > +        def->mem.soft_limit = 0;
> > > +
> > > +    if (virXPathULong("string(./memtune/min_guarantee[1])", ctxt, 
> > > +                      &def->mem.min_guarantee) < 0)
> > > +        def->mem.min_guarantee = 0;
> > > +
> > > +    if (virXPathULong("string(./memtune/swap_hard_limit[1])", ctxt, 
> > > +                      &def->mem.swap_hard_limit) < 0)
> > > +        def->mem.swap_hard_limit = 0;
> > > +
> > 
> > Quick question, does 0 represent invalid values? 
> If configuration file does not provide any value, we set this to 0, we
> do not call the lower layer calls in this case.
> 
> > I'd presume you'd
> > want to use something like -1. We support unsigned long long for the
> > values to be set (64 bit signed), unlimited translates to 2^63 - 1, is
> > ULong sufficient to represent that value?
> The unit here is KB, so we can have till 2^42 bytes. So to answer you
> question, no it does not represent 64 bit signed. I guess this should not be
> an issue to support if needed.
> 
> I understand that in case of cgroup unlimited is (-1), but again that
> would be cgroup specific at this level. I need to think of some way to address
> this independent of the lower layer.
> 
> > > +        unsigned long hard_limit;
> > > +        unsigned long soft_limit;
> > > +        unsigned long min_guarantee;
> > > +        unsigned long swap_hard_limit;
> > 
> > The hard_limit, soft_limit, swap_hard_limit are s64 and the value is
> > in bytes. What is the unit supported in this implementation?

Actually if libvirt is built on 32bit these aren't big enough - make
them into 'unsigned long long' data types I reckon.

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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