Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 27 May 2015 16:01:50 +0300 (MSK)
From: Alexander Monakov <amonakov@...ras.ru>
To: musl@...ts.openwall.com
Subject: Re: Question re: dynamic linking in musl

On Wed, 27 May 2015, Alex Dowad wrote:
> > Can you also provide exact figures?  For example your callgrind logs?  Or
> > just
> > 'time' statistics for executables that spend much time in the dynamic
> > linker.
> Callgrind data attached.

Oh.  The profile makes it evident that most of the libraries lack .gnu.hash,
and the lookup is almost always using SysV lookup.  With many dependencies
SysV lookup is slower: in my testing with Clang/LLVM I got something like 420
ms (compared to 240 ms unpatched or 110 ms patched musl with .gnu.hash
lookup).

I'm not familiar with Alpine.  Hopefully someone else can chime in whether
.gnu.hash is deliberately disabled.

(since raw callgrind log is not readable, I'm pasting callgrind_annotate'd
version of your data below)

Alexander

--------------------------------------------------------------------------------
Profile data file '/tmp/callgrind.out.8354' (creator: callgrind-3.10.1)
--------------------------------------------------------------------------------
I1 cache: 
D1 cache: 
LL cache: 
Timerange: Basic block 0 - 2937079
Trigger: Program termination
Profiled target:  rrdtool update test.rrd N:0:1:U (PID 8354, part 1)
Events recorded:  Ir
Events shown:     Ir
Event sort order: Ir
Thresholds:       99
Include dirs:     
User annotated:   
Auto-annotation:  off

--------------------------------------------------------------------------------
        Ir 
--------------------------------------------------------------------------------
13,149,006  PROGRAM TOTALS

--------------------------------------------------------------------------------
       Ir  file:function
--------------------------------------------------------------------------------
4,483,216  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/ldso/dynlink.c:sysv_lookup [/lib/ld-musl-i386.so.1]
3,678,465  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/strcmp.c:strcmp [/lib/ld-musl-i386.so.1]
2,002,146  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/ldso/dynlink.c:find_sym [/lib/ld-musl-i386.so.1]
  823,546  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/ldso/dynlink.c:sysv_hash [/lib/ld-musl-i386.so.1]
  779,623  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/ldso/dynlink.c:do_relocs [/lib/ld-musl-i386.so.1]
  351,069  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/ldso/dynlink.c:gnu_lookup [/lib/ld-musl-i386.so.1]
  145,380  ???:0x00011f38 [/lib/ld-musl-i386.so.1]
   56,370  ???:0x0002ad86 [/usr/lib/libgobject-2.0.so.0.4200.0]
   48,357  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/stdio/vfprintf.c:printf_core [/lib/ld-musl-i386.so.1]
   45,725  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/ldso/dynlink.c:load_library [/lib/ld-musl-i386.so.1]
   40,118  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/ldso/dynlink.c:decode_vec [/lib/ld-musl-i386.so.1]
   35,294  ???:0x0002ad34 [/usr/lib/libgobject-2.0.so.0.4200.0]
   35,056  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/i386/memset.s:0x0004c919 [/lib/ld-musl-i386.so.1]
   30,486  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/malloc/calloc.c:calloc [/lib/ld-musl-i386.so.1]
   29,919  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/malloc/malloc.c:free [/lib/ld-musl-i386.so.1]
   28,151  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/malloc/malloc.c:malloc [/lib/ld-musl-i386.so.1]
   27,275  ???:g_str_hash [/usr/lib/libglib-2.0.so.0.4200.0]
   26,987  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/strncmp.c:strncmp [/lib/ld-musl-i386.so.1]
   20,900  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/strlen.c:strlen [/lib/ld-musl-i386.so.1]
   20,638  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/strchrnul.c:strchrnul [/lib/ld-musl-i386.so.1]
   20,052  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/stdio/fwrite.c:__fwritex [/lib/ld-musl-i386.so.1]
   20,046  ???:0x00032dd4 [/usr/lib/libglib-2.0.so.0.4200.0]
   15,075  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/ldso/dynlink.c:map_library [/lib/ld-musl-i386.so.1]
   13,535  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/strcspn.c:strcspn [/lib/ld-musl-i386.so.1]
   13,074  ???:g_value_register_transform_func [/usr/lib/libgobject-2.0.so.0.4200.0]
   12,988  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/i386/memcpy.s:0x0004c3ce [/lib/ld-musl-i386.so.1]
   12,720  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/stdio/vfprintf.c:pad [/lib/ld-musl-i386.so.1]
   11,908  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/memchr.c:memchr [/lib/ld-musl-i386.so.1]
   11,092  ???:0x00008060 [/usr/lib/libgobject-2.0.so.0.4200.0]
   10,941  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/ldso/dynlink.c:decode_dyn [/lib/ld-musl-i386.so.1]
    9,784  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/malloc/malloc.c:trim [/lib/ld-musl-i386.so.1]
    9,192  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/env/getenv.c:getenv [/lib/ld-musl-i386.so.1]
    8,912  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/stdio/vfprintf.c:out [/lib/ld-musl-i386.so.1]
    8,593  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/malloc/malloc.c:unbin [/lib/ld-musl-i386.so.1]
    8,060  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/malloc/malloc.c:bin_index [/lib/ld-musl-i386.so.1]
    7,244  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/i386/memmove.s:0x0004c891 [/lib/ld-musl-i386.so.1]
    6,960  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/stdio/vsnprintf.c:vsnprintf [/lib/ld-musl-i386.so.1]
    6,579  ???:0x000270c4 [/usr/lib/libgobject-2.0.so.0.4200.0]
    6,484  ???:0x00032f3c [/usr/lib/libglib-2.0.so.0.4200.0]
    6,422  ???:0x000330e7 [/usr/lib/libglib-2.0.so.0.4200.0]
    6,339  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/ldso/dynlink.c:load_deps [/lib/ld-musl-i386.so.1]
    6,312  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/strspn.c:strspn [/lib/ld-musl-i386.so.1]
    6,171  ???:0x00050c1f [/usr/lib/libglib-2.0.so.0.4200.0]
    6,080  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/stdio/vfprintf.c:vfprintf [/lib/ld-musl-i386.so.1]
    5,743  ???:0x00024749 [/usr/lib/libgobject-2.0.so.0.4200.0]
    5,574  ???:0x00082a88 [/usr/lib/libglib-2.0.so.0.4200.0]
    5,529  ???:g_hash_table_insert [/usr/lib/libglib-2.0.so.0.4200.0]
    5,165  ???:0x000244d1 [/usr/lib/libgobject-2.0.so.0.4200.0]
    4,860  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/strchr.c:strchr [/lib/ld-musl-i386.so.1]
    4,774  ???:0x0002ad02 [/usr/lib/libgobject-2.0.so.0.4200.0]
    4,648  ???:g_hash_table_lookup [/usr/lib/libglib-2.0.so.0.4200.0]
    3,816  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/stdio/vfprintf.c:pop_arg [/lib/ld-musl-i386.so.1]
    3,790  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/stpcpy.c:stpcpy [/lib/ld-musl-i386.so.1]
    3,709  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/internal/syscall_ret.c:__syscall_ret [/lib/ld-musl-i386.so.1]
    3,634  ???:g_malloc0 [/usr/lib/libglib-2.0.so.0.4200.0]
    3,619  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/internal/i386/syscall.s:0x0001cbd7 [/lib/ld-musl-i386.so.1]
    3,592  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/ldso/dynlink.c:path_open.constprop.3 [/lib/ld-musl-i386.so.1]
    3,441  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/string/memrchr.c:memrchr [/lib/ld-musl-i386.so.1]
    3,386  /home/buildozer/aports/main/musl/src/musl-1.1.5/src/thread/pthread_rwlock_unlock.c:pthread_rwlock_unlock [/lib/ld-musl-i386.so.1]

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.