netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: David Ahern <dsahern@kernel.org>, Ivan Babrou <ivan@cloudflare.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
	kernel-team <kernel-team@cloudflare.com>,
	Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Paolo Abeni <pabeni@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Subject: Re: Stacks leading into skb:kfree_skb
Date: Tue, 18 Jul 2023 15:36:31 -0700	[thread overview]
Message-ID: <20230718153631.7a08a6ec@kernel.org> (raw)
In-Reply-To: <e64291ac-98e0-894f-12cb-d01347aef36c@kernel.org>

On Fri, 14 Jul 2023 18:54:14 -0600 David Ahern wrote:
> > I made some aggregations for the stacks we see leading into
> > skb:kfree_skb endpoint. There's a lot of data that is not easily
> > digestible, so I lightly massaged the data and added flamegraphs in
> > addition to raw stack counts. Here's the gist link:
> > 
> > * https://gist.github.com/bobrik/0e57671c732d9b13ac49fed85a2b2290  
> 
> I see a lot of packet_rcv as the tip before kfree_skb. How many packet
> sockets do you have running on that box? Can you accumulate the total
> packet_rcv -> kfree_skb_reasons into 1 count -- regardless of remaining
> stacktrace?

On a quick look we have 3 branches which can get us to kfree_skb from
packet_rcv:

	if (skb->pkt_type == PACKET_LOOPBACK)
		goto drop;
...
	if (!net_eq(dev_net(dev), sock_net(sk)))
		goto drop;
...
	res = run_filter(skb, sk, snaplen);
	if (!res)
		goto drop_n_restore;

I'd guess is the last one? Which we should mark with the SOCKET_FILTER
drop reason? 

  parent reply	other threads:[~2023-07-18 22:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14 22:13 Stacks leading into skb:kfree_skb Ivan Babrou
2023-07-15  0:54 ` David Ahern
2023-07-18 22:33   ` Ivan Babrou
2023-07-18 22:43     ` David Ahern
2023-07-18 22:36   ` Jakub Kicinski [this message]
2023-07-19  3:10     ` Yan Zhai
2023-07-19  3:50       ` David Ahern
2023-07-19 13:18         ` Willem de Bruijn
2023-07-19 13:26           ` Eric Dumazet

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=20230718153631.7a08a6ec@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=ivan@cloudflare.com \
    --cc=kernel-team@cloudflare.com \
    --cc=mhiramat@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=willemdebruijn.kernel@gmail.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).