lkml.org 
[lkml]   [2015]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC] x86: enforce inlining for atomics
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.
--


\
 
 \ /
  Last update: 2015-04-21 00:21    [W:0.079 / U:2.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site