Use MAP_POPULATE to reduce pagefault when available
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 29 Jul 2019 18:49:59 +0000 (14:49 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 29 Jul 2019 18:57:54 +0000 (14:57 -0400)
commit4d4838bad480d48424bddc686f5ad0089e28ac94
tree5ce61c67e2d5d4b7d6611ddddb645099d5aca8c3
parent61e520fbc01329423ff3f80be7171eb48cabd085
Use MAP_POPULATE to reduce pagefault when available

Any ring buffer configuration bigger than PAGE_SIZE would result
in an increased latency for the first tracepoint hit (1200ns) landing on a
new PAGE_SIZE sized chunk of the mapped memory. This happens at least
for the first ring buffer traversal.

To alleviate this we can use MAP_POPULATE that will "prefault" the page
tables.

A similar flag seems to exist on freebsd (MAP_PREFAULT_READ) but I do
not have access to a system to test it and ensure it does indeed results
in the same effect. It mostly indicates that it prefaults for the
read case so I doubt it is the case.

Default to using MAP_POPULATE on Linux only for now. Support of
prefaulting on other platforms will be added as needed.

Link: https://lists.lttng.org/pipermail/lttng-dev/2019-July/029116.html
Link: https://lists.lttng.org/pipermail/lttng-dev/2019-July/029122.html
Tested-by: Yiteng Guo <guoyiteng@gmail.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
libringbuffer/Makefile.am
libringbuffer/mmap.h [new file with mode: 0644]
libringbuffer/shm.c
This page took 0.026343 seconds and 4 git commands to generate.