From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH v2 08/16] xen: derive NUMA node affinity from hard and soft CPU affinity Date: Fri, 15 Nov 2013 15:17:57 +0100 Message-ID: <1384525077.3896.18.camel@Abyss> References: <20131113190852.18086.5437.stgit@Solace> <20131113191214.18086.51921.stgit@Solace> <5284EA84.30506@eu.citrix.com> <1384446603.29902.170.camel@Abyss> <5285FCF3.5030207@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4376015182505125476==" Return-path: In-Reply-To: <5285FCF3.5030207@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 , Keir Fraser , Ian Campbell , Li Yechen , Andrew Cooper , Juergen Gross , Ian Jackson , xen-devel@lists.xen.org, Jan Beulich , Justin Weaver , Matt Wilson , Elena Ufimtseva List-Id: xen-devel@lists.xenproject.org --===============4376015182505125476== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-4CY0kHgz6qxreMxLPNJj" --=-4CY0kHgz6qxreMxLPNJj Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On ven, 2013-11-15 at 10:52 +0000, George Dunlap wrote: > On 14/11/13 16:30, Dario Faggioli wrote: > > > I'm not sure I fully get what you mean... I cannot afford neglecting > > online_affinity, independently from how cpumask and cpumask_soft look > > like, because that's what's needed to account for cpupools. Anyway, I'l= l > > think more about it and see if I can make it better. >=20 > So what you have here is (in pseudocode): >=20 > online_affinity =3D hard_affinity & online; > cpumask |=3D online_affinity; > cpumask_soft |=3D soft_affinity; >=20 > if ( intersects(cpumask, cpumask_soft) ) > cpumask &=3D cpumask_soft; >=20 > So at least four full bitwise operations, plus "intersects" which will= =20 > be the equivalent of a full bitwise operation if it turns out to be false= . >=20 Well, that's not exactly what I have. Fact is, _every_ vcpu has a soft_affinity and a hard_affinity. That's why I have the cpumask_or()-s in the loop, to build a hard haffinity and a soft affinity mask of the _domain_, by ||-ing all the hard (soft) affinity of all the vcpus. =46rom the pseudo code above (and even from the one below), it's not clear to me whether you mean vcpu hard (and soft) affinity or domain ones. In fact... > How about something like the following: >=20 > cpumask_hard =3D hard_affinity & online; > cpumask_soft =3D cpumask_hard & soft_affinity; >=20 > cpumask_p =3D is_empty(cpumask_soft) ? &cpumask_hard : &cpumask_soft; >=20 ... From reading this last pseudo-statement I think you actually mean the affinity masks for the whole domain, which is exactly what I also want to consider... But I have to construct them somehow... That's, again, form where the cpumask_or()-s come. So, thanking this per-vcpu-ness into account, what I have is: for_each_vcpu(i) dom_cpumask_hard |=3D online & cpumask_hard(i) dom_cpumask_soft |=3D cpumask_soft(i) if ( dom_cpumask_hard & dom_cpumask_soft ) dom_cpumask =3D dom_cpumask_hard & dom_cpumask_soft else Perhaps I can rename the variable with something like this 'dom_' prefix in the real code too, to make things more clear. However, it is indeed true that online is per domain, so yes, perhaps I can ddo something like the following: for_each_vcpu(i) dom_cpumask_hard |=3D cpumask_hard(i) dom_cpumask_soft |=3D cpumask_soft(i) dom_cpumask_hard &=3D online dom_cpumask_soft &=3D dom_cpumask_hard dom_cpumask_p =3D is_empty(dom_cpumask_soft) ? dom_cpumask_hard : dom_cpumask_soft; I think it's both more efficient and more clear than what I have now, and I give you that it's close enough to what you were suggesting... But I don't think I can ditch the '|=3D' in the loop for building up the two domain wide cpumasks. How do you like it? Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-4CY0kHgz6qxreMxLPNJj 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.15 (GNU/Linux) iEUEABECAAYFAlKGLRYACgkQk4XaBE3IOsRMbwCgi5ae79vvJYMwZg+zrXoFIFX/ rAIAl1RWgcS+VGtuWe2LBpKsDsjeMfM= =HUG0 -----END PGP SIGNATURE----- --=-4CY0kHgz6qxreMxLPNJj-- --===============4376015182505125476== 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 --===============4376015182505125476==--