tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Hinted mmap(2) without MAP_FIXED can fail prematurely



>>> If it would ignore the hint, what's the point of the hint then?
>> With MAP_FIXED it must use the hint, without it's just a best effort
>> attempt.
> Which then basically means that without MAP_FIXED, the hint don't
> really mean anything?

Sure it does.

It means it will use the hint if that space is available.  Otherwise it
will find somewhere else.

An example of a case where this is appropriate might be an IRIX-style
(I think it was IRIX I saw this on) pre-relocated shared library: if
the place it is pre-relocated to is available, it can be mapped there
and some work saved; otherwise, oh well, map it somewhere else and
we'll have to re-relocate.

Another example might be some data structure where it can save some
work (or space) to have two blocks contiguous, but if they're not, it
can deal, just slightly more expensively.

> It will take whatever address it can come up with, no matter what you
> put into the hint.

Yes, but if the hint _is_ available, it can save some work to use it.
That's why calling it a hint is appropriate: "I'd _like_ this address,
but I can deal with not getting it".

> If I'm ok with it taking any random address, then I shouldn't provide
> a hint.

_Being OK with_ any address doesn't mean there isn't some specific
address you'd _prefer_.  It's like me connecting to an IRC server: I'd
_prefer_ Mouse as my nick, but if it's not available I can deal.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index