]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Add copy_map_value_long to copy to remote percpu memory
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Sun, 4 Sep 2022 20:41:14 +0000 (22:41 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 7 Sep 2022 18:45:28 +0000 (11:45 -0700)
commite70ab6267f16041e599c45c4edb55a104587e7a8
tree370e555559cee9bf7aa0238aa0dfaf2545d3a3aa
parent2a0d22545d785746174736a9eacee98502944bc3
bpf: Add copy_map_value_long to copy to remote percpu memory

bpf_long_memcpy is used while copying to remote percpu regions from BPF
syscall and helpers, so that the copy is atomic at word size
granularity.

This might not be possible when you copy from map value hosting kptrs
from or to percpu maps, as the alignment or size in disjoint regions may
not be multiple of word size.

Hence, to avoid complicating the copy loop, we only use bpf_long_memcpy
when special fields are not present, otherwise use normal memcpy to copy
the disjoint regions.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20220904204145.3089-2-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h