Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Jun 2009 19:37:38 -0500
From:      Alan Cox <alan.l.cox@gmail.com>
To:        "Sean P. Dew" <freebsd.work@gmail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: segment alignment in AMD64
Message-ID:  <ca3526250906281737w771c7825sfb006f6046c18b91@mail.gmail.com>
In-Reply-To: <45d874490906281642r470089e2sc5b770f239f428e2@mail.gmail.com>
References:  <45d874490906281642r470089e2sc5b770f239f428e2@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jun 28, 2009 at 6:42 PM, Sean P. Dew <freebsd.work@gmail.com> wrote:

> Hi,
>
> Why is a loadable segment aligned to 1 MB on AMD64 while the pagezie is
> still 4K for a user application. Is there anyway to change it back to 4K,
> It
> is not making sense to me is because if my file segment is around 400K, we
> are wasting 1 MB of virtual address space ( granted it is not a lot for
> X64).  I am trying to find out the reason. I am posting the readelf output
> of a .so. Any help is appreciated.
>

You'll find this question discussed in the mailing list archives on more
than one occasion.  Here is one such message:

http://lists.freebsd.org/pipermail/freebsd-amd64/2007-September/010260.html

To be a little more explicit, it is done to increase the likelihood that the
entire code segment of a large program can be mapped using 2 MB page
mappings.  Moreover, to be able to do so without wasting any physical memory
on padding.  Although we have the necessary 2 MB page support in the virtual
memory system, the kernel's image activator hasn't been modified to take
advantage of this.  Only a few programs with large code and data segments,
e.g., emacs, will benefit.

Regards,
Alan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ca3526250906281737w771c7825sfb006f6046c18b91>