From: john@jjdev.com (John de la Garza)
To: kernelnewbies@lists.kernelnewbies.org
Subject: the cost of inlining?
Date: Thu, 4 Dec 2014 22:14:00 -0500 [thread overview]
Message-ID: <20141205031359.GA48038@crux.local> (raw)
In-Reply-To: <4E5779AD88B2F040B8A7E83ECF544D1A583634@SJCPEX01CL03.citrite.net>
On Fri, Dec 05, 2014 at 01:32:35AM +0000, Jeff Haran wrote:
> $ cat atomic_read.c
>
> #include <asm/atomic.h>
> #include <asm/system.h>
>
> int samp_atomic_read(atomic_t *v)
> {
> int val;
>
> val = atomic_read(v);
> return val;
> }
I couldn't get it to build with the #inclue <asm/system.h>, but it built
when I removed it.
> I dump the resultant .ko, I get this:
>
> > objdump -S -M intel atomic_read.ko
>
> atomic_read.ko: file format elf64-x86-64
>
>
> Disassembly of section .text:
>
> 0000000000000000 <samp_atomic_read>:
> #include <asm/atomic.h>
> #include <asm/system.h>
>
> int samp_atomic_read(atomic_t *v)
> {
> 0: 55 push rbp
> 1: 48 89 e5 mov rbp,rsp
> 4: e8 00 00 00 00 call 9 <samp_atomic_read+0x9>
> *
> * Atomically reads the value of @v.
> */
> static inline int atomic_read(const atomic_t *v)
> {
> return v->counter;
> 9: 8b 07 mov eax,DWORD PTR [rdi]
> int val;
>
> val = atomic_read(v);
> return val;
> }
> b: c9 leave
> c: c3 ret
> d: 90 nop
> e: 90 nop
> f: 90 nop
>
My ouput differs:
john at vega:~/foo$ objdump -S -M intel atomic_read.ko
atomic_read.ko: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <samp_atomic_read>:
0: 55 push rbp
1: 8b 07 mov eax,DWORD PTR [rdi]
3: 48 89 e5 mov rbp,rsp
6: 5d pop rbp
7: c3 ret
next prev parent reply other threads:[~2014-12-05 3:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-05 1:32 the cost of inlining? Jeff Haran
2014-12-05 3:14 ` John de la Garza [this message]
2014-12-05 22:35 ` Jeff Haran
2014-12-06 2:53 ` John de la Garza
2014-12-06 3:25 ` Max Filippov
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=20141205031359.GA48038@crux.local \
--to=john@jjdev.com \
--cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).