From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH] skbuff: remove pointless conditional before kfree_skb() Date: Tue, 28 Aug 2012 07:12:34 -0700 Message-ID: <1346163154.3571.6.camel@edumazet-glaptop> References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: davem@davemloft.net, yongjun_wei@trendmicro.com.cn, netdev@vger.kernel.org To: Wei Yongjun Return-path: Received: from mail-pz0-f46.google.com ([209.85.210.46]:63069 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751637Ab2H1OMh (ORCPT ); Tue, 28 Aug 2012 10:12:37 -0400 Received: by dady13 with SMTP id y13so3339107dad.19 for ; Tue, 28 Aug 2012 07:12:37 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Tue, 2012-08-28 at 21:10 +0800, Wei Yongjun wrote: > From: Wei Yongjun > > Remove pointless conditional before kfree_skb(). > > Signed-off-by: Wei Yongjun > --- > include/linux/skbuff.h | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > index 7632c87..0b846d9 100644 > --- a/include/linux/skbuff.h > +++ b/include/linux/skbuff.h > @@ -2464,8 +2464,7 @@ static inline void nf_conntrack_get_reasm(struct sk_buff *skb) > } > static inline void nf_conntrack_put_reasm(struct sk_buff *skb) > { > - if (skb) > - kfree_skb(skb); > + kfree_skb(skb); > } > #endif > #ifdef CONFIG_BRIDGE_NETFILTER > Its not exactly pointless. Its a tradeoff between kernel code size, and ability for cpu to predict a branch in kfree_skb() This test is in hot path, and therefore this patch can potentially have a performance impact. I really think most kfree_skb() calls are done with a non NULL param, so the branch prediction is good. But after this patch, things are totally different. Therefore, I am against it.