Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: axp-list@redhat.com
Subject: Re: /proc/<pid>/maps
Date: Fri, 17 Mar 2000 17:08:51 -0800	[thread overview]
Message-ID: <20000317170851.A4725@twiddle.net> (raw)
In-Reply-To: <412568A5.00832BF4.00@saturn.aladdin.de>

On Sat, Mar 18, 2000 at 12:48:21AM +0100, cpg@aladdin.de wrote:
> If I look at /proc/<pid>/maps I've got 3 entries for every shared lib
> the process uses. On i386 there are only 2 entries for each shlib
[...]
> What is the purpose of this mapping and where does it come from?

This is an artifact of the glibc ld.so.  It will appear on any
architecture that has a maximum architectural page size larger
than the current os page size.

What happens is that glibc reserves the entire memory region
that it needs with PROT_NONE.  We do this because all segments
must have a fixed relationship with one another, so we have
mmap bring us the first unused contiguous region that's large
enough.

We then goes back and remap the actual Phdr entries with proper
permissions and MAP_FIXED.  If, for the reason mentioned above,
the linker has "overaligned" the data segment, then there may be
unused space between the text and data segment.

We could of course unmap that region, but there's not really
any point.  On no system that I am aware of will it be larger
than 16 pages, which means that the PMD is already in use,
which means that we're not really consuming any extra page
table resources.

The lack of foresight in not defining a large maximum architectural
page size for x86 is actually hurting ia64 folks who want to do
emulation.  Ideally they'd like to have a 16K system page size,
but all the x86 binaries are linked expecting a 4K page size.
Which can be worked around with effort, but it shouldn't have
been necessary.


r~


  reply	other threads:[~2000-03-18  1:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-17 23:48 /proc/<pid>/maps cpg
2000-03-18  1:08 ` Richard Henderson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-03-18  1:50 /proc/<pid>/maps cpg
2000-03-18  2:05 ` /proc/<pid>/maps Richard Henderson
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox