netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Phil Oester <kernel@linuxace.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	Florian Westphal <fw@strlen.de>,
	netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: remove redundant skb check in nf_conntrack_put_reasm
Date: Thu, 20 Jun 2013 16:15:37 +0200	[thread overview]
Message-ID: <20130620141537.GH2124@breakpoint.cc> (raw)
In-Reply-To: <20130620000135.GB819@gmail.com>

Phil Oester <kernel@linuxace.com> wrote:
> On Thu, Jun 20, 2013 at 11:58:46AM +0200, Pablo Neira Ayuso wrote:
> > On Thu, Jun 20, 2013 at 11:22:59AM +0200, Florian Westphal wrote:
> > > Phil Oester <kernel@linuxace.com> wrote:
> > > > kfree_skb already checks for skb existence - remove redundant check from
> > > > nf_conntrack_put_reasm.
> > > 
> > > This is called for every free'd skb, in almost all cases
> > > the condition will be false.
> > > 
> > > So I think its ok to keep this check.
> > 
> > I see, we'll hit branch mispredictions most of the time. I have kept
> > this back. Thanks Florian.
> 
> If we're concerned about branch mispredictions, we should change the check to
> match the one at the top of kfree_skb:
>         if (unlikely(!skb))
>                 return;

Its the opposite.  For kfree_skb skb is (virtually) never NULL.

> However nf_conntrack_put_reasm is only used in 3 places in the entire tree.
> Unclear why we don't just call kfree_skb directly in these 3 places.

I guess what you could do is s/nf_conntrack_put_reasm/kfree_skb/g and
also change skb_release_head_state() to use

#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
        if (skb->nfct) /* usually NULL */
	        kfree_skb(skb->nfct);
#endif

[ or show that there is no performance degradation for workloads where
  we end up calling kfree_skb(NULL) in hot path ]

  reply	other threads:[~2013-06-20 14:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-19 14:27 [PATCH] netfilter: remove redundant skb check in nf_conntrack_put_reasm Phil Oester
2013-06-20  9:22 ` Florian Westphal
2013-06-20  9:58   ` Pablo Neira Ayuso
2013-06-20  0:01     ` Phil Oester
2013-06-20 14:15       ` Florian Westphal [this message]
2013-06-20  9:49 ` Pablo Neira Ayuso

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=20130620141537.GH2124@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=kernel@linuxace.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /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).