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] [day] [month] [year] [list]
Message-ID: <4f57fb3f-3d33-41d7-99e0-7867395ce792@redhat.com>
Date: Tue, 3 Feb 2026 09:27:41 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Marek Mietus <mmietus97@...oo.com>, netdev@...r.kernel.org,
 sd@...asysnail.net, kuba@...nel.org
Cc: Jason@...c4.com
Subject: Re: [PATCH net-next v7 07/11] net: tunnel: convert ip_md_tunnel_xmit
 to use a noref dst when possible

On 1/27/26 8:04 AM, Marek Mietus wrote:
> ip_md_tunnel_xmit unnecessarily references the dst_entry from the
> dst_cache when interacting with the cache.
> 
> Reduce this overhead by avoiding the redundant refcount increments.
> 
> This is only possible in flows where the cache is used. Otherwise, we
> fall-back to a referenced dst.
> 
> This change is safe since ipv4 supports noref xmit under RCU which is
> already the case for ip_md_tunnel_xmit.
> 
> Signed-off-by: Marek Mietus <mmietus97@...oo.com>
> ---
>  net/ipv4/ip_tunnel.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
> index 2136a46bcdc5..40ff6ad9b9b9 100644
> --- a/net/ipv4/ip_tunnel.c
> +++ b/net/ipv4/ip_tunnel.c
> @@ -609,7 +609,7 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
>  
>  	use_cache = ip_tunnel_dst_cache_usable(skb, tun_info);
>  	if (use_cache)
> -		rt = dst_cache_get_ip4(&tun_info->dst_cache, &fl4.saddr);
> +		rt = dst_cache_get_ip4_rcu(&tun_info->dst_cache, &fl4.saddr);
>  	if (!rt) {
>  		rt = ip_route_output_key(tunnel->net, &fl4);
>  		if (IS_ERR(rt)) {
> @@ -617,11 +617,12 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
>  			goto tx_error;
>  		}
>  		if (use_cache)
> -			dst_cache_set_ip4(&tun_info->dst_cache, &rt->dst,
> -					  fl4.saddr);
> +			dst_cache_steal_ip4(&tun_info->dst_cache, &rt->dst,
> +					    fl4.saddr);

Similarly to what Sabrina noted on patch 4/11 it looks like that:
		else
			ip_rt_put(rt);

here will avoid a bit of later conditionals. Similar note for patch 8/11.

I must add that the amount of code churn and possible regressions looks
IMHO excessive for the reported performance delta.

/P

/P


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ