linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: sdf@google.com
Cc: Martin KaFai Lau <kafai@fb.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Song Liu <songliubraving@fb.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [BPF PATCH for-next] cgroup/bpf: fast path for not loaded skb BPF filtering
Date: Tue, 14 Dec 2021 18:00:22 +0000	[thread overview]
Message-ID: <5e2bc4bc-e844-9a8c-2a95-0f55645b4392@gmail.com> (raw)
In-Reply-To: <YbjaSNBlW03rX6c7@google.com>

On 12/14/21 17:54, sdf@google.com wrote:
> On 12/11, Pavel Begunkov wrote:
>> On 12/11/21 01:56, Martin KaFai Lau wrote:
>> > On Sat, Dec 11, 2021 at 01:15:05AM +0000, Pavel Begunkov wrote:
>> > > That was the first idea, but it's still heavier than I'd wish. 0.3%-0.7%
>> > > in profiles, something similar in reqs/s. rcu_read_lock/unlock() pair is
>> > > cheap but anyway adds 2 barrier()s, and with bitmasks we can inline
>> > > the check.
>> > It sounds like there is opportunity to optimize
>> > __cgroup_bpf_prog_array_is_empty().
>> >
>> > How about using rcu_access_pointer(), testing with &empty_prog_array.hdr,
>> > and then inline it?  The cgroup prog array cannot be all
>> > dummy_bpf_prog.prog.  If that could be the case, it should be replaced
>> > with &empty_prog_array.hdr earlier, so please check.
> 
>> I'd need to expose and export empty_prog_array, but that should do.
>> Will try it out, thanks
> 
> Note that we already use __cgroup_bpf_prog_array_is_empty in
> __cgroup_bpf_run_filter_setsockopt/__cgroup_bpf_run_filter_getsockopt
> for exactly the same purpose. If you happen to optimize it, pls
> update these places as well.

Just like it's already done in the patch? Or maybe you mean something else?

-- 
Pavel Begunkov

  reply	other threads:[~2021-12-14 18:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-10  2:23 [BPF PATCH for-next] cgroup/bpf: fast path for not loaded skb BPF filtering Pavel Begunkov
2021-12-11  0:38 ` Martin KaFai Lau
2021-12-11  1:15   ` Pavel Begunkov
2021-12-11  1:56     ` Martin KaFai Lau
2021-12-11  2:20       ` Pavel Begunkov
2021-12-14 17:54         ` sdf
2021-12-14 18:00           ` Pavel Begunkov [this message]
2021-12-14 18:04             ` Stanislav Fomichev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e2bc4bc-e844-9a8c-2a95-0f55645b4392@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@google.com \
    --cc=songliubraving@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).