bpf: Pull out a macro for interpreting atomic ALU operations
authorBrendan Jackman <jackmanb@google.com>
Thu, 14 Jan 2021 18:17:48 +0000 (18:17 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 15 Jan 2021 02:34:29 +0000 (18:34 -0800)
commit462910670e4ac91509829c5549bd0227668176fb
tree6d97a7890d74d3be0dd65e0f1822c3e57e8f4a25
parent5ffa25502b5ab3d639829a2d1e316cff7f59a41e
bpf: Pull out a macro for interpreting atomic ALU operations

Since the atomic operations that are added in subsequent commits are
all isomorphic with BPF_ADD, pull out a macro to avoid the
interpreter becoming dominated by lines of atomic-related code.

Note that this sacrificies interpreter performance (combining
STX_ATOMIC_W and STX_ATOMIC_DW into single switch case means that we
need an extra conditional branch to differentiate them) in favour of
compact and (relatively!) simple C code.

Signed-off-by: Brendan Jackman <jackmanb@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210114181751.768687-9-jackmanb@google.com
kernel/bpf/core.c