mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: musl@lists.openwall.com
Subject: Re: Question re: dynamic linking in musl
Date: Wed, 27 May 2015 13:40:24 +0300 (MSK)	[thread overview]
Message-ID: <alpine.LNX.2.11.1505271323270.19145@monopod.intra.ispras.ru> (raw)
In-Reply-To: <20150527100844.GA306@alex-ThinkPad-L530>

On Wed, 27 May 2015, Alex Dowad wrote:
> I'm just dealing with a problem whereby rrdtool is spending >90% of its runtime in
> musl's dynamic linker (this is on Alpine Linux). This is making it too slow to do
> what we need it to do.

That implies that rrdtool spawns an executable with many dynamic dependencies
over and over again, with each individual invocation doing extremely little
work.  That sounds wasteful.  Do you know why it does that?

Can you confirm that the behavior is similarly bad on glibc with LD_BIND_NOW=1
set in the environment?  The main difference between musl and glibc is that
glibc perform "lazy binding" while musl fully resolves all symbol dependenies
at load time.

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.

> NOW: Is there any reason why dso->deps could not be used to search for symbols *only*
> in the dependencies of the binary which is currently being relocated?

That is not how ELF symbol lookup works.  Simply put, the symbol should be
taken from whatever first module in the whole lookup chain provides it; e.g.
if the executable exports a function that is also exported in libX11, the
executable's definition prevails.
 

Recently I was working on some dynamic linker speedups for musl.  On my
testcase, Clang/LLVM with ~100-200 dynamic libraries and ~20000 symbols that
need to be resolved in the dynamic linker, I obtained a speedup from 240 ms to
110 ms, while glibc needs 50 ms with lazy binding and 140 without.  So while
musl's dynamic linker speed can be improved, still rrdtool is doing something
odd in the first place if it's performance is bound like that.  I'd like to
understand that.  If it's unavoidable, perhaps static linking is appropriate.

(I didn't send my dynlink speedup patches yet;  I intend to do that sometime
soon)

Alexander


  reply	other threads:[~2015-05-27 10:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 10:08 Alex Dowad
2015-05-27 10:40 ` Alexander Monakov [this message]
2015-05-27 11:18   ` Alex Dowad
2015-05-27 13:01     ` Alexander Monakov
2015-05-27 13:09       ` Timo Teras
2015-05-27 13:15         ` Alex Dowad
2015-05-27 13:23           ` Timo Teras
2015-05-27 14:06             ` Szabolcs Nagy
2015-05-27 14:06             ` Rich Felker
2015-05-28 14:03               ` Natanael Copa
2015-05-27 13:06     ` Szabolcs Nagy

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=alpine.LNX.2.11.1505271323270.19145@monopod.intra.ispras.ru \
    --to=amonakov@ispras.ru \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).