]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Introducte bpf_this_cpu_ptr()
authorHao Luo <haoluo@google.com>
Tue, 29 Sep 2020 23:50:48 +0000 (16:50 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 2 Oct 2020 22:00:49 +0000 (15:00 -0700)
commit8ce8b3318b8524d81eab0546cb5faf35a2237f27
tree1eeb951bd0bc20041d49ef77f68cd17f8096fec6
parentc43edca94f4cf20ae04032ac7b256377fc9f38fb
bpf: Introducte bpf_this_cpu_ptr()

Add bpf_this_cpu_ptr() to help access percpu var on this cpu. This
helper always returns a valid pointer, therefore no need to check
returned value for NULL. Also note that all programs run with
preemption disabled, which means that the returned pointer is stable
during all the execution of the program.

Signed-off-by: Hao Luo <haoluo@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200929235049.2533242-6-haoluo@google.com
include/linux/bpf.h
include/uapi/linux/bpf.h
kernel/bpf/helpers.c
kernel/bpf/verifier.c
kernel/trace/bpf_trace.c
tools/include/uapi/linux/bpf.h