From: David Miller <davem@davemloft.net>
To: weigelt@metux.de
Cc: linux-kernel@vger.kernel.org
Subject: Re: Dynamic linking in the kernel
Date: Sat, 20 Feb 2010 12:57:58 -0800 (PST) [thread overview]
Message-ID: <20100220.125758.174837163.davem@davemloft.net> (raw)
In-Reply-To: <4B802870.5030201@metux.de>
From: Enrico Weigelt <weigelt@metux.de>
Date: Sat, 20 Feb 2010 19:22:40 +0100
> Starting up an dynamically linked executable tends to need a lot
> of syscalls. A kernel-based dynamic linker could cache a lot of
> relocation data (eg. when the same binary is called many times),
> share pages even w/o mmap(), and the ldstub wouldnt be needed
> anymore.
This is not practical.
In order to implement this the kernel would have to also save a copy
of all pieces of the processes's environment and compare all of the
environment variable settings on every execution. This would be
needed to handle things like LD_PRELOAD, LD_LIBRARY_PATH, and LD_DEBUG
as just three examples.
What's more, any filesystem change involved in the shared libraries,
the executable, or the dynamic linker would have to be monitored as
well.
Really, this is not a good idea, and the cost is only ~3 system calls
per shared library and considering the amount of flexibility we get in
return it's not that bad at all.
Actually, the more expensive part of shared libraries are the page
faults from filling in the relocations and we already have a mechanism
to save that cost, it's called 'prelink'.
next prev parent reply other threads:[~2010-02-20 20:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-20 18:22 Enrico Weigelt
2010-02-20 20:57 ` David Miller [this message]
2010-02-22 5:43 ` Enrico Weigelt
2010-02-22 6:21 ` David Miller
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=20100220.125758.174837163.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=weigelt@metux.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
all inboxes | Powered by JetHome®