[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 07 of 10 v2] libxl: optimize the calculation of how many VCPUs can run on a candidate



On Fri, 2012-12-21 at 16:00 +0000, George Dunlap wrote: 
> On 19/12/12 19:07, Dario Faggioli wrote:
> > For choosing the best NUMA placement candidate, we need to figure out
> > how many VCPUs are runnable on each of them. That requires going through
> > all the VCPUs of all the domains and check their affinities.
> >
> > With this change, instead of doing the above for each candidate, we
> > do it once for all, populating an array while counting. This way, when
> > we later are evaluating candidates, all we need is summing up the right
> > elements of the array itself.
> >
> > This reduces the complexity of the overall algorithm, as it moves a
> > potentially expensive operation (for_each_vcpu_of_each_domain {})
> > outside from the core placement loop, so that it is performed only
> > once instead of (potentially) tens or hundreds of times.
> >
> > Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
> 
> You know this code best. :-)  I've looked it over and just have one 
> minor suggestion:
> 
Well, I certainly spent quite a bit of time on it, and it still is in
need of some more, but again, this change only speed things up at no
"functional cost", so (despite this not being a critical path) I really
think it is something we want.

BTW, thanks for taking a look.

> >           for (j = 0; j < nr_dom_vcpus; j++) {
> > +            /* For each vcpu of each domain, increment the elements of
> > +             * the array corresponding to the nodes where the vcpu runs */
> > +            libxl_bitmap_set_none(&vcpu_nodemap);
> > +            libxl_for_each_set_bit(k, vinfo[j].cpumap) {
> > +                int node = tinfo[k].node;
> 
> I think I might rename "vcpu_nodemap" to something that suggests better 
> how it fits with the algorithm -- for instance, "counted_nodemap" or 
> "nodes_counted" -- something to suggest that this is how we avoid 
> counting the same vcpu on the same node multiple times.
> 
Good point, I'll go for something like that.

Thanks and Regards,
Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)


Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.