Subject: Re: Add a MAP_ALIGNED flag for mmap(2).
To: Nathan J. Williams <nathanw@wasabisystems.com>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 03/01/2003 11:24:17
At 09:24 AM 3/1/2003, Nathan J. Williams wrote:
>Matt Thomas <matt@3am-software.com> writes:
>
> > Currently, ld.elf_so doesn't honor the alignment specified in a
> > ELF file's psections.  This is due to the lack of ability to request
> > an aligned block of addresses from mmap(2).  I propose we add a
> > MAP_ALIGNED flag which would mean that the addr argument to mmap(2)
> > would be the required alignment of the block.  Supplying both
> > MAP_ALIGNED|MAP_FIXED would cause an error EINVAL to be returned.
> >
> > Any thought on this proposal?
>
>I'll note that the same effect can be achieved by requesting a region
>of size double-alignment (e.g. requesting a 2M region when you want 1M
>alignment) and then using munmap() to trim the edges down to the
>aligned region inside it. Less efficent, of course, but quite
>possible.

Only for a single threaded processes.  If you have multiple threads,
then they could stomp over each other.


-- 
Matt Thomas               Internet:   matt@3am-software.com
3am Software Foundry      WWW URL:    http://www.3am-software.com/bio/matt/
Cupertino, CA             Disclaimer: I avow all knowledge of this message