summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSong Liu <songliubraving@fb.com>2020-09-30 15:49:26 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-09-30 23:18:12 -0700
commit792caccc4526bb489e054f9ab61d7c024b15dea2 (patch)
tree3a37926e19cd8a4ad165269eb80c7b8d2096414e /tools
parent3effc06a4dde3e2f6ee3d82e59d97ec357802a4b (diff)
bpf: Introduce BPF_F_PRESERVE_ELEMS for perf event array
Currently, perf event in perf event array is removed from the array when the map fd used to add the event is closed. This behavior makes it difficult to the share perf events with perf event array. Introduce perf event map that keeps the perf event open with a new flag BPF_F_PRESERVE_ELEMS. With this flag set, perf events in the array are not removed when the original map fd is closed. Instead, the perf event will stay in the map until 1) it is explicitly removed from the array; or 2) the array is freed. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200930224927.1936644-2-songliubraving@fb.com
Diffstat (limited to 'tools')
-rw-r--r--tools/include/uapi/linux/bpf.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 1f17c6752deb..4f556cfcbfbe 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -414,6 +414,9 @@ enum {
/* Enable memory-mapping BPF map */
BPF_F_MMAPABLE = (1U << 10),
+
+/* Share perf_event among processes */
+ BPF_F_PRESERVE_ELEMS = (1U << 11),
};
/* Flags for BPF_PROG_QUERY. */