]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Introduce BPF_F_PRESERVE_ELEMS for perf event array
authorSong Liu <songliubraving@fb.com>
Wed, 30 Sep 2020 22:49:26 +0000 (15:49 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 1 Oct 2020 06:18:12 +0000 (23:18 -0700)
commit079756a026c6b3a7d2cc3bc0643952b60bf3aea3
tree3a37926e19cd8a4ad165269eb80c7b8d2096414e
parent34fa212ef3e98f1f2d0782b2ece5f28b143231d4
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
include/uapi/linux/bpf.h
kernel/bpf/arraymap.c
tools/include/uapi/linux/bpf.h