netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] gro: small napi_get_frags() optim
Date: Thu, 05 Dec 2013 22:11:08 -0800	[thread overview]
Message-ID: <1386310268.31845.13.camel@joe-AO722> (raw)
In-Reply-To: <1386308667.30495.230.camel@edumazet-glaptop2.roam.corp.google.com>

On Thu, 2013-12-05 at 21:44 -0800, Eric Dumazet wrote:
> Remove one useless conditional branch : 
> napi->skb is NULL, so nothing bad can happen.
[]
> diff --git a/net/core/dev.c b/net/core/dev.c
[]
> @@ -3981,8 +3981,7 @@ struct sk_buff *napi_get_frags(struct napi_struct *napi)
>  
>  	if (!skb) {
>  		skb = netdev_alloc_skb_ip_align(napi->dev, GRO_MAX_HEAD);
> -		if (skb)
> -			napi->skb = skb;
> +		napi->skb = skb;

Thanks, I agree this patch is appropriate as skb is unlikely
to be NULL in normal cases.

But just for thought: isn't the test expense essentially
free when skb is in a register vs the member set cost?

Also, netdev_alloc_skb_ip_align is static inline and it has
a test of
	if (NET_IP_ALIGN && skb)
just before the return so this "if (skb)" test could already
be elided by a good compiler but this change requires an
unconditional set.

  reply	other threads:[~2013-12-06  6:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06  5:44 [PATCH net-next] gro: small napi_get_frags() optim Eric Dumazet
2013-12-06  6:11 ` Joe Perches [this message]
2013-12-06  6:26   ` Eric Dumazet
2013-12-06 17:52 ` David Miller

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=1386310268.31845.13.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.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).