From: Borislav Petkov <bp@alien8.de>
To: Hagen Paul Pfeifer <hagen@jauu.net>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH RFC] x86: enforce inlining for atomics
Date: Mon, 20 Apr 2015 23:56:45 +0200 [thread overview]
Message-ID: <20150420215645.GC10191@pd.tnic> (raw)
In-Reply-To: <1429565231-4609-1-git-send-email-hagen@jauu.net>
On Mon, Apr 20, 2015 at 11:27:11PM +0200, Hagen Paul Pfeifer wrote:
> During some code analysis I realized that atomic_add, atomic_sub and
> friends are not necessarily inlined AND that each function is defined
> multiple times:
>
> atomic_inc: 544 duplicates
> atomic_dec: 215 duplicates
> atomic_dec_and_test: 107 duplicates
> atomic64_inc: 38 duplicates
> [...]
>
> Each definition is exact equally, e.g.:
>
> ffffffff813171b8 <atomic_add>:
> 55 push %rbp
> 48 89 e5 mov %rsp,%rbp
> f0 01 3e lock add %edi,(%rsi)
> 5d pop %rbp
> c3 retq
>
> In turn each definition has one or more callsites (sure):
>
> ffffffff81317c78: e8 3b f5 ff ff callq ffffffff813171b8 <atomic_add>
> [...]
> ffffffff8131a062: e8 51 d1 ff ff callq ffffffff813171b8 <atomic_add>
> [...]
> ffffffff8131a190: e8 23 d0 ff ff callq ffffffff813171b8 <atomic_add>
> [...]
Hmm, that must be config-specific as doing
objdump -D vmlinux | grep -i "atomic_add"
here gives me only "drm_atomic_add_affected_connectors" matches.
It probably gets inlined here always...
Other than that, this patch should actually even show some speedup as
we're getting rid of the stack preparation and function call overhead.
Have you done any benchmarks with it?
Thanks.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
next prev parent reply other threads:[~2015-04-20 21:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-20 21:27 [PATCH RFC] x86: enforce inlining for atomics Hagen Paul Pfeifer
2015-04-20 21:56 ` Borislav Petkov [this message]
2015-04-20 22:08 ` Hagen Paul Pfeifer
2015-04-21 7:42 ` Ingo Molnar
2015-04-21 10:56 ` Hagen Paul Pfeifer
2015-04-21 22:57 ` Hagen Paul Pfeifer
2015-04-22 0:57 ` Linus Torvalds
2015-04-22 5:24 ` Markus Trippelsdorf
2015-04-22 5:58 ` Hagen Paul Pfeifer
2015-04-22 9:20 ` Markus Trippelsdorf
2015-04-22 9:28 ` Ingo Molnar
2015-04-22 9:31 ` Hagen Paul Pfeifer
2015-04-30 1:52 ` Henrique de Moraes Holschuh
2015-07-13 18:27 ` Denys Vlasenko
2015-07-13 19:20 ` Hagen Paul Pfeifer
2015-07-13 21:06 ` Denys Vlasenko
2015-07-13 21:12 ` Hagen Paul Pfeifer
2015-07-13 18:25 ` Denys Vlasenko
2015-04-20 23:46 ` Peter Zijlstra
2015-04-22 14:10 ` [tip:x86/asm] x86/asm: Always inline atomics tip-bot for Hagen Paul Pfeifer
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=20150420215645.GC10191@pd.tnic \
--to=bp@alien8.de \
--cc=hagen@jauu.net \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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