]> 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)
commit006b432d78bd9e493a7beaab667e15f2e6be2b36
tree1eeb951bd0bc20041d49ef77f68cd17f8096fec6
parent876b6eed9700a0cd2d722b0ef176842d2cad2003
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