]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: auto-set PERF_EVENT_ARRAY size to number of CPUs
authorAndrii Nakryiko <andriin@fb.com>
Sat, 6 Jul 2019 18:06:25 +0000 (11:06 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 8 Jul 2019 13:35:43 +0000 (15:35 +0200)
commit4a1f464e76c6467eece7aee302fa6bc92fcd3de2
treea3ff890eaa896d7a5da5a87b8cae2f48c7eb184f
parent3e9c4f0d3be64d56fa0e043e10b1f976cb49fd4f
libbpf: auto-set PERF_EVENT_ARRAY size to number of CPUs

For BPF_MAP_TYPE_PERF_EVENT_ARRAY typically correct size is number of
possible CPUs. This is impossible to specify at compilation time. This
change adds automatic setting of PERF_EVENT_ARRAY size to number of
system CPUs, unless non-zero size is specified explicitly. This allows
to adjust size for advanced specific cases, while providing convenient
and logical defaults.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/lib/bpf/libbpf.c