Netdev List
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <hawk@kernel.org>
To: Jakub Sitnicki <jakub@cloudflare.com>,
	netdev@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Stanislav Fomichev <sdf@fomichev.me>
Cc: bpf@vger.kernel.org, kernel-team@cloudflare.com,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Jiri Olsa <jolsa@kernel.org>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Simon Horman <horms@kernel.org>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Subject: Re: [PATCH net-next 00/14] skb extension for BPF metadata
Date: Fri, 21 Aug 2026 11:27:43 +0200	[thread overview]
Message-ID: <64365932-c765-472e-bf6c-b07c9ee25eaf@kernel.org> (raw)
In-Reply-To: <20260814-bpf-meta-inside-skb-ext-v1-0-767edd862656@cloudflare.com>



On 14/08/2026 10.14, Jakub Sitnicki wrote:
> [I realize net-next closes soon. Posting only to collect more feedback.]
> 
> Please see the RFC cover letter for the overview [1].
> I will focus here just on the latest developments.
> 
> 1) Based on feedback from the RFC - the BPF skb extension is *no longer
> scrubbed* on tunnel encap/decap or veth traversal. There is also *no
> mechanism* to enable scrubbing as we don't seem to have a use case for it.
> 
> 2) Since the RFC I've enabled access to BPF skb extension for the remaining
> BPF program types which operate on skbs, namely netfilter, lwt family, and
> - everyone's favorite - sk_skb.
> 
> Outside the patch set, two things happened:
> 
> 3) At NetConf 2026 Kuniyuki presented effectively the same idea with a use
> case in mind to attach metadata to packets on egress (IIRC). Hoping for
> feedback if this meets your needs as well.
> 
> 4) At BPF Summit 2026, Alexei asked - I'm paraphrasing: What percentage of
> skbs will carry metadata in our workload? This determines if the cost of
> attaching a tracing prog to consume_skb gets amortized. We've run
> experiments and have some answers.
> 
> If bpf skb ext existed today, we would adopt it to attach metadata to
> incoming TCP connections and ingress UDP packets to CDN to identify flows
> that have been forwarded from one PoP to another.
> 
> Based on stats from a production node where we've been testing this patch
> set, the fraction of skbs that would carry the metadata is <1% (~0.7%):
> 
> ```
> 923m16$ sudo perf stat -a -r 10 \
>              -e skb:consume_skb -e skb:kfree_skb \
>              -e probe:skb_ext_add -- sleep 1
> 
>   Performance counter stats for 'system wide' (10 runs):
> 
>             334,256      skb:consume_skb                            ( +-  1.63% )
>               1,525      skb:kfree_skb                              ( +-  4.09% )
>               2,218      probe:skb_ext_add                          ( +- 18.58% )
> 
>             1.02305 +- 0.00243 seconds time elapsed  ( +-  0.24% )
> ```
> 
> I expect that even if we adopted bpf skb ext for other use cases we have in
> mind, like labeling egress CDN packets with a customer identifier, we would
> attach metadata only to around 5% of all skbs in flight.
> 
> We've run an experiment to evaluate this patch set - bpf skb extension -
> against the alternative - using a BPF map keyed by &skb (LRU_HASH) to stash
> metadata plus consume/kfree_skb tracepoint programs to clean up the
> entries.
> 
> To do that we've modified the CDN component that labels the incoming
> connections forwarded from another PoP:
> 
> - with bpf skb ext, BPF progs involved in processing consumed 7.5..10 CPU%,
> - with BPF map + consume/kfree_skb tp, the overhead was between 15..20 CPU%
> 
> Not surprising considering the low fraction of skbs we attach metadata to.
> (For graphs see slides 30 & 40 from our presentation at Netdev 0x1A [2].)
> 

It seems quite clear to me that the kfree_skb tracepoint approach have
too high overhead.  Simply due to frequency as it getting invoked for
ALL packets in the system.

--Jesper




> [1] https://patch.msgid.link/20260714-bpf-meta-inside-skb-ext-v1-0-5871c07a8dd6@cloudflare.com
> [2] https://github.com/jsitnicki/talks/blob/5d64c151f4dc0c38b2832fdcbce7284ec93fdca2/Netdev%200x1A%20-%20Thrice%20the%20charm%20-%20an%20skb%20extension%20for%20BPF%20metadata.pdf
> 

      parent reply	other threads:[~2026-08-21  9:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14  8:14 [PATCH net-next 00/14] skb extension for BPF metadata Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 01/14] bpf: Introduce per-packet metadata storage for BPF programs Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 02/14] bpf: Allow access to bpf_sock_ops_kern->skb Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 03/14] bpf: Make BPF skb extension survive packet scrubbing Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 04/14] selftests/bpf: Add tests for bpf_dynptr_from_skb_ext Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 05/14] selftests/bpf: Test skb_ext on cloned skbs Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 06/14] selftests/bpf: Test skb_ext survival across veth and GRE Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 07/14] selftests/bpf: Test skb_ext read from cgroup_skb and sk_filter hooks Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 08/14] selftests/bpf: Test skb_ext read from sock_ops and LSM hooks Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 09/14] selftests/bpf: Test skb_ext read from kfree_skb tracepoint Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 10/14] selftests/bpf: Test skb_ext read from netfilter hook Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 11/14] selftests/bpf: Test skb_ext from LWT in, out, and xmit hooks Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 12/14] selftests/bpf: Test skb_ext read from seg6local End.BPF hook Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 13/14] selftests/bpf: Test skb_ext read from sk_skb stream verdict hook Jakub Sitnicki
2026-08-16 14:11   ` Jack Wang
2026-08-14  8:14 ` [PATCH net-next 14/14] selftests/bpf: Use non-trivial test payload in xdp_context tests Jakub Sitnicki
2026-08-18  1:37 ` [PATCH net-next 00/14] skb extension for BPF metadata Jakub Kicinski
2026-08-21  9:27 ` Jesper Dangaard Brouer [this message]

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=64365932-c765-472e-bf6c-b07c9ee25eaf@kernel.org \
    --to=hawk@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=emil@etsalapatis.com \
    --cc=horms@kernel.org \
    --cc=jakub@cloudflare.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=yonghong.song@linux.dev \
    /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