PCH support on Solaris
Fri Apr 4 22:15:00 GMT 2003
Paolo Bonzini wrote:
>> Note that there is a way to ensure no existing mappings will be
>> clobbered before using MAP_FIXED on Solaris, without having to
>> try to get some other mapping at that location first:
>Yes, that's why Eric does an anonymous mmap with PROT_NONE and MAP_NORESERVE
>first. I don't understand why you cannot do that only and you need separate
>heuristics. Do you have a measurable performance decrease (which I don't
I don't think this is a performance issue, but a correctness issue.
You suggested (in an earlier mail) this:
> guess = mmap (mmi.preferred_base, mmi.size, PROT_NONE,
> MAP_PRIVATE|MAP_ANON|MAP_NORESERVE, -1, 0);
> if (guess == (caddr_t) -1)
> warning ("PCH not usable");
> _If getting that area is not possible, the OS will not unmap anything!_
However, if you do not use MAP_FIXED, the OS will treat the address
parameter as merely a hint, which it is free to ignore completely
-- and in fact this is what in my experience (at least some versions)
of Solaris tend to do. So it is easily possible that this mmap
will always succeed, but never return guess == mmi.preferred_base.
Using MAP_FIXED subsequently with the address guess doesn't then
buy you anything ...
This is why I don't quite see what the benefit of this mmap is
supposed to be. The only way to make sure a mapping is placed
at some specific location is to use MAP_FIXED, and this can only
be used if you're sure there is nothing else mapped at that
location; to check the latter you can use the mincore () trick
(I don't know of any way to reliably use mmap to do this).
Dr. Ulrich Weigand
More information about the Gcc-patches