On Wed, Jan 13, 2021 at 1:33 PM Stanislav Fomichev <sdf@xxxxxxxxxx> wrote: > > Add custom implementation of getsockopt hook for TCP_ZEROCOPY_RECEIVE. > We skip generic hooks for TCP_ZEROCOPY_RECEIVE and have a custom > call in do_tcp_getsockopt using the on-stack data. This removes > 3% overhead for locking/unlocking the socket. > > Without this patch: > 3.38% 0.07% tcp_mmap [kernel.kallsyms] [k] __cgroup_bpf_run_filter_getsockopt > | > --3.30%--__cgroup_bpf_run_filter_getsockopt > | > --0.81%--__kmalloc > > With the patch applied: > 0.52% 0.12% tcp_mmap [kernel.kallsyms] [k] __cgroup_bpf_run_filter_getsockopt_kern > > Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxx> > Cc: Martin KaFai Lau <kafai@xxxxxx> > Cc: Song Liu <songliubraving@xxxxxx> > Cc: Eric Dumazet <edumazet@xxxxxxxxxx> > Acked-by: Martin KaFai Lau <kafai@xxxxxx> Few issues in this patch and the patch 2 doesn't apply: Switched to a new branch 'tmp' Applying: bpf: Remove extra lock_sock for TCP_ZEROCOPY_RECEIVE .git/rebase-apply/patch:295: trailing whitespace. #endif .git/rebase-apply/patch:306: trailing whitespace. union tcp_word_hdr { .git/rebase-apply/patch:309: trailing whitespace. }; .git/rebase-apply/patch:311: trailing whitespace. #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) .git/rebase-apply/patch:313: trailing whitespace. enum { warning: squelched 1 whitespace error warning: 6 lines add whitespace errors. Applying: bpf: Try to avoid kzalloc in cgroup/{s,g}etsockopt error: patch failed: kernel/bpf/cgroup.c:1390 error: kernel/bpf/cgroup.c: patch does not apply Patch failed at 0002 bpf: Try to avoid kzalloc in cgroup/{s,g}etsockopt