This is the mail archive of the
mailing list for the binutils project.
Re: glibc: loading of shared objects with holes wastes address space
On Tue, Oct 18, 2011 at 6:59 PM, Roland McGrath <firstname.lastname@example.org> wrote:
>> It's not the processor that matters here, it's the kernel. ?The question
>> is whether the kernel will want to some day require executables to use a
>> larger page size.
> It's not necessarily even a question of "require". ?The kernel might decide
> that the mapping for a particular executable or DSO (at a particular time,
> even) is worthwhile to align to a 2M boundary so it can use the hardware
> feature of 2MB-aligned page table entries for that mapping.
Sure, it can do so. But it can only do so if the mapping itself is a
multiple of 2MB. Otherwise it would map more bytes then requested
which would clearly be a violation of the semantics of mmap(2).
> If it does so,
> and the second segment is aligned 2M away from the first, then it can use
> 2M page table entries for both segments.
The second mapping would naturally be aligned to 2MB if the preceding
segment is a multiple of 2MB, even when p_align is only 4kB.