This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
How to avoid the use of mmap for arena allocation?
- From: Clemens Eisserer <linuxhippy at gmail dot com>
- To: libc-help at sourceware dot org
- Date: Tue, 22 Mar 2016 20:37:00 +0100
- Subject: How to avoid the use of mmap for arena allocation?
- Authentication-results: sourceware.org; auth=none
Hello,
Following the advice on rt.wiki.kernel.org for our soft-rt-system, we
would like to reduce the number / avoid of page-faults and
memory-management related syscalls (brk/sbrk/mmap) during runtime, so
our strategy is:
* M_MMAP_MAX = 0
* M_TRIM_THRESHOLD = -1
* M_TOP_PAD = 2000*1024*1024
* mlockall(MCL_CURRENT | MCL_FUTURE)
So once the first allocation is performed, the process break is
extended by ~2G and immediatly backed by physical pages.
Everything works fine, as long as we are not using threads because
arenas are again allocated using mmap() - and because of
mlockall(MCL_FUTURE) these exhibit now horrible latencies.
By setting M_ARENA_MAX = -1 I was able to disable the use of arenas -
which has it's own downsides.
Is there a way to tell the allocator to allocate arenas inside the
process space already reserved by the previous brk-call?
Thank you in advance, Clemens
PS: Another question, is there a way to specify a M_TOP_PAD > the
value of signed int?