From: compudj@krystal.dyndns.org (Mathieu Desnoyers)
Subject: [ltt-dev] [PATCH] LTTng optimize write to page function
Date: Wed, 4 Feb 2009 12:54:21 -0500 [thread overview]
Message-ID: <20090204175421.GA28035@Krystal> (raw)
In-Reply-To: <20090204155207.ECC6.KOSAKI.MOTOHIRO@jp.fujitsu.com>
* 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
prev parent reply other threads:[~2009-02-04 17:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-03 17:10 Mathieu Desnoyers
2009-02-03 17:47 ` [ltt-dev] [PATCH] LTTng optimize write to page function (v2) Mathieu Desnoyers
2009-02-04 1:12 ` [ltt-dev] [PATCH] LTTng optimize write to page function Lai Jiangshan
2009-02-04 2:35 ` Mathieu Desnoyers
2009-02-04 3:53 ` Mathieu Desnoyers
2009-02-04 4:07 ` Zhaolei
2009-02-04 4:53 ` Mathieu Desnoyers
2009-02-04 4:34 ` KOSAKI Motohiro
2009-02-04 5:44 ` Mathieu Desnoyers
2009-02-04 8:09 ` KOSAKI Motohiro
2009-02-04 17:54 ` Mathieu Desnoyers [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090204175421.GA28035@Krystal \
--to=compudj@krystal.dyndns.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox