From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH v3 3/7] libxc: vnodes allocation on NUMA nodes. Date: Tue, 19 Nov 2013 15:22:28 +0100 Message-ID: <1384870948.19880.87.camel@Abyss> References: <1384806262-12532-1-git-send-email-ufimtseva@gmail.com> <1384806262-12532-4-git-send-email-ufimtseva@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2948381974272148397==" Return-path: In-Reply-To: <1384806262-12532-4-git-send-email-ufimtseva@gmail.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: Elena Ufimtseva Cc: keir@xen.org, Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com, george.dunlap@eu.citrix.com, msw@linux.com, lccycc123@gmail.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, JBeulich@suse.com List-Id: xen-devel@lists.xenproject.org --===============2948381974272148397== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-qAe6Oh6gfLcr/ifwTpYC" --=-qAe6Oh6gfLcr/ifwTpYC Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On lun, 2013-11-18 at 15:24 -0500, Elena Ufimtseva wrote: > Signed-off-by: Elena Ufimtseva > diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c > index e034d62..1839360 100644 > @@ -802,27 +802,47 @@ int arch_setup_meminit(struct xc_dom_image *dom) > else > { > /* try to claim pages for early warning of insufficient memory a= vail */ > + rc =3D 0; > if ( dom->claim_enabled ) { > rc =3D xc_domain_claim_pages(dom->xch, dom->guest_domid, > dom->total_pages); > if ( rc ) > + { > + xc_dom_panic(dom->xch, XC_INTERNAL_ERROR, > + "%s: Failed to claim mem for dom\n", > + __FUNCTION__); > return rc; > + } > Mmm... here you're just adding some log output. I think it's a minor thing, i.e., it's not terrible to have this in this patch. However, ideally, this should happen in its own patch, as it is not much related to vNUMA, is it? > /* allocate guest memory */ > - for ( i =3D rc =3D allocsz =3D 0; > - (i < dom->total_pages) && !rc; > - i +=3D allocsz ) > + if ( dom->nr_vnodes > 0 ) > { > - allocsz =3D dom->total_pages - i; > - if ( allocsz > 1024*1024 ) > - allocsz =3D 1024*1024; > - rc =3D xc_domain_populate_physmap_exact( > - dom->xch, dom->guest_domid, allocsz, > - 0, 0, &dom->p2m_host[i]); > + rc =3D arch_boot_numa_alloc(dom); > + if ( rc ) > + { > + xc_dom_panic(dom->xch, XC_INTERNAL_ERROR, > + "%s: Failed to allocate memory on NUMA node= s\n", > + __FUNCTION__); > + return rc; > + } > + } > + else > + { > + for ( i =3D rc =3D allocsz =3D 0; > + (i < dom->total_pages) && !rc; > + i +=3D allocsz ) > + { > + allocsz =3D dom->total_pages - i; > + if ( allocsz > 1024*1024 ) > + allocsz =3D 1024*1024; > + rc =3D xc_domain_populate_physmap_exact( > + dom->xch, dom->guest_domid, allocsz, > + 0, 0, &dom->p2m_host[i]); > + } > } I think I agree with George's comment from last round: do unify the two paths (yes, I saw it's on the TODO for this patch... so, go ahead and do it :-) ). > +int arch_boot_numa_alloc(struct xc_dom_image *dom) > +{=20 > + int rc; > + unsigned int n; > + unsigned long long guest_pages; > + unsigned long long allocsz =3D 0, node_pfn_base, i; > + unsigned long memflags; > + > + rc =3D allocsz =3D node_pfn_base =3D 0; > =20 > + allocsz =3D 0; > + for ( n =3D 0; n < dom->nr_vnodes; n++ ) > + { > + memflags =3D 0; > + if ( dom->vnode_to_pnode[n] !=3D VNUMA_NO_NODE ) > + { > + memflags |=3D XENMEMF_exact_node(dom->vnode_to_pnode[n]); > + memflags |=3D XENMEMF_exact_node_request; > + } > + guest_pages =3D (dom->vnuma_memszs[n] << 20) >> PAGE_SHIFT_X86; > I probably would call this 'pages_node' (or 'node_pages', or 'guest_pages_node', etc.), but that's also something not that important. :-) Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-qAe6Oh6gfLcr/ifwTpYC 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) iEYEABECAAYFAlKLdCQACgkQk4XaBE3IOsTm6QCdFaQz0Yje5KFbOJlupXkpRjX8 ikoAoIdatTg5kpdi69Z590hydcAjt/sc =4ZGL -----END PGP SIGNATURE----- --=-qAe6Oh6gfLcr/ifwTpYC-- --===============2948381974272148397== 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 --===============2948381974272148397==--