[PATCH][RFC] Allow explicit shrinking of arena heaps using an environment variable

KOSAKI Motohiro kosaki.motohiro@gmail.com
Tue Jul 31 05:24:00 GMT 2012


On Mon, Jul 30, 2012 at 3:17 PM, Rich Felker <dalias@aerifal.cx> wrote:
> On Mon, Jul 30, 2012 at 02:18:58PM -0400, KOSAKI Motohiro wrote:
>> munmap also need tlb shoot down and mmap(MAP_FIXED) region overwritten
>> internally call munmap in kernel. so i don't think tlb shoot down makes
>> performance difference.
>>
>> mmap(MAP_FIXED) and MADV_DONTNEED have different concurrency level.
>> mmap() take a write lock of mmap_sem. MADV_DONTNEED only takes read lock.
>> (note: it's no difference if program is single threaded. mamp_sem is
>> per-process lock)
>
> The choices are not mmap(MAP_FIXED) vs madvise(MADV_DONTNEED). They
> are mmap(MAP_FIXED) vs madvise(MADV_DONTNEED) followed by
> mprotect(PROT_NONE).

If PROT_NONE is must one, I don't see any reason to don't take mmap(MAP_FIXED).

but..
Why do we need PROT_NONE? just for /proc/maps?

> I suspect the latter also needs a write lock on
> mmap_sem.

Right.



More information about the Libc-alpha mailing list