Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Dec 2011 15:02:01 +0100 (CET)
From:      "Ganael LAPLANCHE" <ganael.laplanche@martymac.org>
To:        Andriy Gapon <avg@FreeBSD.org>, Tijl Coosemans <tijl@coosemans.org>
Cc:        freebsd-stable@FreeBSD.org
Subject:   Re: Using mmap(2) with a hint address
Message-ID:  <20111220134716.M62917@martymac.org>
In-Reply-To: <4EF05F27.8030902@FreeBSD.org>
References:  <20111220080437.M63044@martymac.org> <4EF05F27.8030902@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Andriy, Hi Tijl,

On Tue, 20 Dec 2011 12:10:47 +0200, Andriy Gapon wrote
> Can the following code explain what you are seeing?
> [...]

Yes, for sure. I had seen this part of the code but, to be honest, had
not understood the meaning of this computation.

On Tue, 20 Dec 2011 11:10:26 +0100, Tijl Coosemans wrote
> FreeBSD reserves quite a bit of space for brk(2) style heap. Your
> program will work if you use higher addresses.
> 
> You can also shrink the reserved space either system wide by setting
> kern.maxdsiz sysctl in /boot/loader.conf, or in your program 
> by setting the maximum RLIMIT_DATA with setrlimit(2).

Thanks for the explanation! Reducing reserved space for data segment
seems to work.

But there is still something I don't understand : on the Linux machine
where I ran my test program, the current RLIMIT_DATA is set to
0xffffffff/0xffffffff and I can manage to mmap at address 0x20000000. If
I set the same limit on FreeBSD, I won't get the mapping at 0x20000000.
So, there *is* a difference of behaviour between the two systems, but I
don't understand why.

Thanks to both of you,
Best regards,

--
Ganael LAPLANCHE <ganael.laplanche@martymac.org>
http://www.martymac.org | http://contribs.martymac.org
FreeBSD: martymac <martymac@FreeBSD.org>, http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111220134716.M62917>