From: Keir Fraser Subject: Re: alloc_heap_pages is low efficient with more CPUs Date: Thu, 11 Oct 2012 16:41:09 +0100 Message-ID: References: <201210112318468920764@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3492283311836442562==" Return-path: In-Reply-To: <201210112318468920764@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: tupeng212 , xen-devel List-Id: xen-devel@lists.xenproject.org > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --===============3492283311836442562== Content-type: multipart/alternative; boundary="B_3432818480_11120560" > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3432818480_11120560 Content-type: text/plain; charset="ISO-8859-1" Content-transfer-encoding: quoted-printable Not sure I understand. With 16 CPUs you find domain startup takes 3s always= . With 64 CPUs you find it takes 3s first time, then 30s in future? And this is due to cost of tlbflush_filter() (not actual TLB flushes, because you always end up with mask=3D0)? If tlbflush_filter() were that expensive I=B9d expect the 16-CPU case to have slowdown after the first domain startup, too= . -- Keir On 11/10/2012 16:18, "tupeng212" wrote: > I am confused with a problem: > I have a blade with 64 physical CPUs and 64G physical RAM, and defined on= ly > one VM with 1 CPU and 40G RAM. > For the first time I started the VM, it just took 3s, But for the second > starting it took 30s. > After studied it by printing log, I have located a place in the hyperviso= r > where cost too much time, > occupied 98% of the whole starting time. > =20 > xen/common/page_alloc.c > /* Allocate 2^@order contiguous pages. */ > static struct page_info *alloc_heap_pages( > unsigned int zone_lo, unsigned int zone_hi, > unsigned int node, unsigned int order, unsigned int memflags) > { > if ( pg[i].u.free.need_tlbflush ) > { > /* Add in extra CPUs that need flushing because of this page.= */ > cpus_andnot(extra_cpus_mask, cpu_online_map, mask); > tlbflush_filter(extra_cpus_mask, pg[i].tlbflush_timestamp); > cpus_or(mask, mask, extra_cpus_mask); > } > =20 > } > =20 > 1 in the first starting, most of need_tlbflush=3DNULL, so cost little; in t= he > second one, most of RAM have been used > thus makes need_tlbflush=3Dtrue, so cost much. > =20 > 2 but I repeated the same experiment in another blade which contains 16 > physical CPUs and 64G physical RAM, the second > starting cost 3s. After I traced the process between the two second > startings, found that count entering into the judgement of > pg[i].u.free.need_tlbflush is the same, but number of CPUs leads to the > difference. > =20 > 3 The code I pasted aims to compute a mask to determine whether it should > flush CPU's TLB. I traced the values in starting period below: > =20 >> =20 >> cpus_andnot(extra_cpus_mask, cpu_online_map, mask); >> =20 >> //after, mask=3D0, cpu_online_map=3D0xFFFFFFFFFFFFFFFF, >> extra_cpus_mask=3D0xFFFFFFFFFFFFFFFF >> =20 >> tlbflush_filter(extra_cpus_mask, pg[i].tlbflush_timestamp); >> =20 >> //after, mask=3D0, extra_cpus_mask=3D0 >> =20 >> cpus_or(mask, mask, extra_cpus_mask); >> =20 >> //after, mask=3D0, extra_cpus_mask=3D0 > =20 > every time it starts with mask=3D0, and ends with the same result mask=3D0,= so > leads to flush CPU's TLB definitely, > which seems meaningless in the staring process. > =20 > 4 The problem is, this seemed meaningless code is very time-consuming, CP= Us > get more, time costs more, it takes 30s here in my blade > with 64 CPUs which may need some solution to improve the efficiency. > =20 >=20 > tupeng >=20 >=20 > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel --B_3432818480_11120560 Content-type: text/html; charset="ISO-8859-1" Content-transfer-encoding: quoted-printable Re: [Xen-devel] alloc_heap_pages is low efficient with more CPUs</TI= TLE> </HEAD> <BODY> <FONT FACE=3D"Calibri, Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:11pt= '>Not sure I understand. With 16 CPUs you find domain startup takes 3s alway= s. With 64 CPUs you find it takes 3s first time, then 30s in future? And thi= s is due to cost of tlbflush_filter() (not actual TLB flushes, because you a= lways end up with mask=3D0)? If tlbflush_filter() were that expensive I’= d expect the 16-CPU case to have slowdown after the first domain startup, to= o.<BR> <BR>  -- Keir<BR> <BR> On 11/10/2012 16:18, "tupeng212" <<a href=3D"tupeng212@gmail.com= ">tupeng212@gmail.com</a>> wrote:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Calibri, Verdana, Helvetica, Arial"><= FONT SIZE=3D"2"><SPAN STYLE=3D'font-size:10pt'>I am confused with a problem:<BR> I have a blade with 64 physical CPUs and 64G physical RAM, and defined only= one VM with 1 CPU and 40G RAM.<BR> For the first time I started the VM, it just took 3s, But for the second st= arting it took 30s. <BR> After studied it by printing log, I have located a place in the hypervisor = where cost too much time, <BR> occupied 98% of the whole starting time.<BR>  <BR> xen/common/page_alloc.c <BR> /* Allocate 2^@order contiguous pages. */<BR> static struct page_info *alloc_heap_pages(<BR>     unsigned int zone_lo, unsigned int zone_hi,<BR>     unsigned int node, unsigned int order, unsigned int= memflags)<BR> {<BR>         if ( pg[i].u.free.need_tlbf= lush )<BR>         {<BR>             /* = Add in extra CPUs that need flushing because of this page. */<BR>             cpu= s_andnot(extra_cpus_mask, cpu_online_map, mask);<BR>             tlb= flush_filter(extra_cpus_mask, pg[i].tlbflush_timestamp);<BR>             cpu= s_or(mask, mask, extra_cpus_mask);<BR>         }<BR>  <BR> }<BR>  <BR> 1 in the first starting, most of need_tlbflush=3DNULL, so cost little; in the= second one, most of RAM have been used <BR>   thus makes need_tlbflush=3Dtrue, so cost much.<BR>  <BR> 2 but I repeated the same experiment in another blade which contains 16 phy= sical CPUs and 64G physical RAM, the second<BR>   starting cost 3s. After I traced the process between the two se= cond startings, found that count entering into the judgement of<BR>   pg[i].u.free.need_tlbflush is the same, but number of CPUs lead= s to the difference.<BR>  <BR> 3 The code I pasted aims to compute a mask to determine whether it should f= lush CPU's TLB. I traced the values in starting period below:<BR>  <BR> </SPAN></FONT></FONT><BLOCKQUOTE><FONT FACE=3D"Calibri, Verdana, Helvetica, A= rial"><FONT SIZE=3D"2"><SPAN STYLE=3D'font-size:10pt'> <BR> cpus_andnot(extra_cpus_mask, cpu_online_map, mask);<BR>  <BR> //after, mask=3D0, cpu_online_map=3D0xFFFFFFFFFFFFFFFF, extra_cpus_mask=3D0xFFFFF= FFFFFFFFFFF<BR>  <BR> tlbflush_filter(extra_cpus_mask, pg[i].tlbflush_timestamp);<BR>  <BR> //after, mask=3D0, extra_cpus_mask=3D0<BR>  <BR> cpus_or(mask, mask, extra_cpus_mask);<BR>  <BR> //after, mask=3D0, extra_cpus_mask=3D0<BR> </SPAN></FONT></FONT></BLOCKQUOTE><FONT FACE=3D"Calibri, Verdana, Helvetica, = Arial"><FONT SIZE=3D"2"><SPAN STYLE=3D'font-size:10pt'> <BR>   every time it starts with mask=3D0, and ends with the same result= mask=3D0, so leads to flush CPU's TLB definitely,  <BR>   which seems meaningless in the staring process.<BR>  <BR> 4 The problem is, this seemed meaningless code is very time-consuming, CPUs= get more, time costs more, it takes 30s here in my blade<BR>   with 64 CPUs which may need some solution to improve the effici= ency.<BR>   <BR> <HR ALIGN=3DLEFT SIZE=3D"1" WIDTH=3D"100%">tupeng<BR> <BR> <HR ALIGN=3DCENTER SIZE=3D"3" WIDTH=3D"95%"></SPAN></FONT></FONT><FONT SIZE=3D"2"><= SPAN STYLE=3D'font-size:10pt'><FONT FACE=3D"Consolas, Courier New, Courier">____= ___________________________________________<BR> Xen-devel mailing list<BR> <a href=3D"Xen-devel@lists.xen.org">Xen-devel@lists.xen.org</a><BR> <a href=3D"http://lists.xen.org/xen-devel">http://lists.xen.org/xen-devel</a>= <BR> </FONT></SPAN></FONT></BLOCKQUOTE> </BODY> </HTML> --B_3432818480_11120560-- --===============3492283311836442562== 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 --===============3492283311836442562==--