From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 07 of 10 v2] libxl: optimize the calculation of how many VCPUs can run on a candidate Date: Fri, 21 Dec 2012 17:23:10 +0100 Message-ID: <1356106990.15403.74.camel@Abyss> References: <5dc2571ae5faef87977c.1355944043@Solace> <50D48780.70302@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7081345392282909730==" Return-path: In-Reply-To: <50D48780.70302@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: Marcus Granado , Dan Magenheimer , Ian Campbell , Anil Madhavapeddy , Andrew Cooper , Juergen Gross , Ian Jackson , "xen-devel@lists.xen.org" , Jan Beulich , Daniel De Graaf , Matt Wilson List-Id: xen-devel@lists.xenproject.org --===============7081345392282909730== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-jdzAz/ddGjKie18pXv8l" --=-jdzAz/ddGjKie18pXv8l Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2012-12-21 at 16:00 +0000, George Dunlap wrote:=20 > 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 throug= h > > 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 >=20 > You know this code best. :-) I've looked it over and just have one=20 > minor suggestion: >=20 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 =3D 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 run= s */ > > + libxl_bitmap_set_none(&vcpu_nodemap); > > + libxl_for_each_set_bit(k, vinfo[j].cpumap) { > > + int node =3D tinfo[k].node; >=20 > I think I might rename "vcpu_nodemap" to something that suggests better= =20 > how it fits with the algorithm -- for instance, "counted_nodemap" or=20 > "nodes_counted" -- something to suggest that this is how we avoid=20 > counting the same vcpu on the same node multiple times. >=20 Good point, I'll go for something like that. Thanks and Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-jdzAz/ddGjKie18pXv8l Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEABECAAYFAlDUjO4ACgkQk4XaBE3IOsRvvwCcDw9Y5W7qYhDesszGiGSuFB6J EDcAni9MK9RVXUL0SYe/5+sKA1DGXe+d =Sqoi -----END PGP SIGNATURE----- --=-jdzAz/ddGjKie18pXv8l-- --===============7081345392282909730== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============7081345392282909730==--