diff options
author | Stanislav Fomichev <sdf@google.com> | 2021-01-15 19:35:01 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-01-21 01:23:00 +0300 |
commit | a9ed15dae0755a0368735e0556a462d8519bdb05 (patch) | |
tree | 9b945424784d01048fb9837d35f81e7e3790b7c7 /net/ipv4/tcp_ipv4.c | |
parent | 20f2505fb436cfa674cf1f46aaa624f44d3d1d03 (diff) | |
download | linux-a9ed15dae0755a0368735e0556a462d8519bdb05.tar.xz |
bpf: Split cgroup_bpf_enabled per attach type
When we attach any cgroup hook, the rest (even if unused/unattached) start
to contribute small overhead. In particular, the one we want to avoid is
__cgroup_bpf_run_filter_skb which does two redirections to get to
the cgroup and pushes/pulls skb.
Let's split cgroup_bpf_enabled to be per-attach to make sure
only used attach types trigger.
I've dropped some existing high-level cgroup_bpf_enabled in some
places because BPF_PROG_CGROUP_XXX_RUN macros usually have another
cgroup_bpf_enabled check.
I also had to copy-paste BPF_CGROUP_RUN_SA_PROG_LOCK for
GETPEERNAME/GETSOCKNAME because type for cgroup_bpf_enabled[type]
has to be constant and known at compile time.
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20210115163501.805133-4-sdf@google.com
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
0 files changed, 0 insertions, 0 deletions