Subject: Re: uvm_map_findspace alignment fallback
To: None <>
From: YAMAMOTO Takashi <>
List: tech-kern
Date: 11/08/2003 19:44:19
> On Sat, Nov 08, 2003 at 04:36:34AM +0900, YAMAMOTO Takashi wrote:
> > for a request with an alignment requirement, uvm_map_findspace
> > tries aligned addresses first and then siliently fall back to
> > non-aligned addresses.
> Could you give more details on goals and reasons of this
> change. What's an advantage? Why it's needed?
> > it might be bad for callers assuming returned addresses are
> > properly aligned.  (e.g. libpthread.)
> It might or it is?

it is.  see pthread__stackalloc().

it can be workarounded in callers like below, but it's ugly, IMO.
is it supposed when MAP_ALIGNED was introduced?

p = mmap(MAP_ALIGNED());
if (p == MMAP_FAILED)
	return ENOMEM;
if (p is not aligned properly) {
	return ENOMEM;

> I suspect that current behavoiur has become
> 'de facto' so there is a possibility to break something with the
> change.

yes.  it's why i mailed. :)