After calling perf_event_open() with cpus == -1 and the inherit bit, using mmap on the perf file descriptor to create a ring-buffer fails with EINVAL. This behavior wasn't previously documented in the man page and is caused by the following lines in the perf_mmap function in kernel/events/core.c: /* * Don't allow mmap() of inherited per-task counters. This would * create a performance issue due to all children writing to the * same rb. */ if (event->cpu == -1 && event->attr.inherit) return -EINVAL; Signed-off-by: Mikołaj Kołek <kolek.mikolaj@xxxxxxxxx> --- man/man2/perf_event_open.2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/man2/perf_event_open.2 b/man/man2/perf_event_open.2 index 2f345ff5b..15a5972d0 100644 --- a/man/man2/perf_event_open.2 +++ b/man/man2/perf_event_open.2 @@ -1025,6 +1025,10 @@ .SS Arguments .I read_format values, such as .BR PERF_FORMAT_GROUP . +Additionally, using it together with +.BR "cpu == -1" +prevents the creation of the mmap ring-buffer used for +logging asynchronous events in sampled mode. .TP .I pinned The -- 2.45.2