]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: implement syscall command BPF_MAP_GET_NEXT_KEY for stacktrace map
authorYonghong Song <yhs@fb.com>
Thu, 4 Jan 2018 21:55:03 +0000 (13:55 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Sat, 6 Jan 2018 22:52:22 +0000 (23:52 +0100)
commit624999a37f102297425dfa5c31a1296971fddab2
treeb77f3dbd1c47e7ca1b3c4687f12385f6e8ab488c
parent6b20060a586a6377fb8acbaac7895d3d800d1faa
bpf: implement syscall command BPF_MAP_GET_NEXT_KEY for stacktrace map

Currently, bpf syscall command BPF_MAP_GET_NEXT_KEY is not
supported for stacktrace map. However, there are use cases where
user space wants to enumerate all stacktrace map entries where
BPF_MAP_GET_NEXT_KEY command will be really helpful.
In addition, if user space wants to delete all map entries
in order to save memory and does not want to close the
map file descriptor, BPF_MAP_GET_NEXT_KEY may help improve
performance if map entries are sparsely populated.

The implementation has similar behavior for
BPF_MAP_GET_NEXT_KEY implementation in hashtab. If user provides
a NULL key pointer or an invalid key, the first key is returned.
Otherwise, the first valid key after the input parameter "key"
is returned, or -ENOENT if no valid key can be found.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/stackmap.c