Sources Bugzilla – Bug 11447
default section layout should be improved to reduce pagefaults
Last modified: 2010-04-13 11:56:04 UTC
I graphed pagefaults on firefox startup which showed that there some bonus page
faults caused by the default section order. The main problem is backwards io
which always causes page faults.
For reference click the second rectange in
x-axis is file offset, y-axis is time
Log of the sections being read is in
Fault #1: This likely can't fixed in ld, but mentioning it in case
Going through the log chronologically there the problems are:
.bss is being zeroed which causes copy-on-write io. Then .dynamic is being
read. The fix should be in the dynamic linker to read .dynamic before memset.
This would allow binaries(where distance between .dynamic and .bss is smaller
than the kernel's readhead) to avoid the .bss pagefault. Perhaps .dynamic should
be the last section before .bss?
Alternatively ld could force .bss to point past the end of the file.
.gnu.version* should be in front of .dyn(sym|str)
.dynstr should be in front of .dynsym
Would be nice if .eh_frame* could be in front of .fini, but as far as I can tell
these have to be in different segments.
Subject: Re: New: default section layout should be improved
to reduce pagefaults
On Mon, Mar 29, 2010 at 08:29:31PM -0000, tglek at mozilla dot com wrote:
> Fault #2
> .gnu.version* should be in front of .dyn(sym|str)
> Fault #3
> .dynstr should be in front of .dynsym
Why? Both .gnu.version and .dynstr are referred to from .dynsym.
ISTM that it would be as easy to improve the loader if it's reading
them in a funny order.
Created attachment 4719 [details]
Reorder .gnu.version, .dynstr and .dynsym
This sounds like a loader problem to me, rather than a binutils bug. It is
relatively easy to rearrange the order of the .gnu.version, .dynstr and .dynsym
sections (see the uploaded patch), but I do not think that this is right way to
solve the problem. If the loader is performing some backwards io to get at
those sections then I would suggest that it ought to be recoded to keep them in
memory after reading them for the first time.