How to avoid the use of mmap for arena allocation?
Clemens Eisserer
linuxhippy@gmail.com
Tue Mar 22 19:37:00 GMT 2016
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?
More information about the Libc-help
mailing list