[ltt-dev] [PATCH] LTTng optimize write to page function

Mathieu Desnoyers compudj at krystal.dyndns.org
Wed Feb 4 12:54:21 EST 2009


* KOSAKI Motohiro (kosaki.motohiro at jp.fujitsu.com) wrote:
> > 
> > void testfct_memcpy(void)
> > {
> >         asm ("/* begin */");
> >         memcpy(dataout, datain, sizea);
> >         asm ("/* end */");
> > }
> > 
> > Turns into a function call because the size is not statically known :
> > 
> >         movslq  sizea(%rip),%rdx
> >         movq    $datain, %rsi
> >         movq    $dataout, %rdi
> >         call    memcpy
> > 
> > 
> > Below, when a constant is passed, both behave similarly :
> > 
> > void testfct_ltt_const(void)
> > {
> >         asm ("/* begin */");
> >         ltt_relay_do_copy(dataout, datain, 8);
> >         asm ("/* end*/");
> > }
> > 
> >         movq    datain(%rip), %rax
> >         movq    %rax, dataout(%rip)
> > 
> > 
> > void testfct_memcpy_const(void)
> > {
> >         asm ("/* begin */");
> >         memcpy(dataout, datain, 8);
> >         asm ("/* end */");
> > }
> > 
> >         movq    datain(%rip), %rax
> >         movq    %rax, dataout(%rip)
> > 
> > 
> > Therefore, I agree that when memcpy is passed a constant, it will do
> > the same as my ltt_relay_do_copy. However, when we know we usually
> > expect sizes of 1, 2, 4 and 8 bytes (unknown at compile-time), the jump
> > table saves the costly function call to memcpy.
> 
> Thank you for good clarification!!
> 
> So, I hope to this result append to patch description.
> I guess many lkml guys like this interesting analysis and result :)
> 

I will append it to the changelog. Thanks for asking such clarification
while everything was still fresh in my mind.

Mathieu

> 
> 
> 
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68




More information about the lttng-dev mailing list