Subject: Re: Add a MAP_ALIGNED flag for mmap(2).
To: None <atatat@atatdot.net>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 03/01/2003 16:32:17
> one thought: i note that the flags argument to mmap() only uses about
> six bits (i dug around a bit, but i didn't see anywhere that used the
> other bit positions for other stuff).  given that the requested
> alignment would (a) presumably be related to pages and (b) would also
> probably be in terms of a power of two thereof, what about stuffing
> MAP_ALIGN into there, along with the bits from
> log2(alignment>>PGSHIFT)?
> 
> the 64 bit address space of, eg, the sparc64 address space, when
> combines with the 13 bit page shift (8k pages) leaves 41 bits.  to
> count to 41, you need only 6 bits, so that would be a total of seven
> bits stuffed into flags.  there's space for it, and you don't lose the
> hint value.
> 
> that said, you could allow both MAP_FIXED and MAP_ALIGN, and refuse it
> based on the hint not aligning properly, as opposed to not allowing
> both.

why don't you simply introduce new mmap-with-alignment-arg syscall?
(and turn mmap(2) to mmap(3)?)

YAMAMOTO Takashi