lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 05 Dec 2013 22:11:08 -0800
From:	Joe Perches <joe@...ches.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	David Miller <davem@...emloft.net>, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] gro: small napi_get_frags() optim

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.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ