diff mbox series

[net-next] net: dst_cache: minor optimization in dst_cache_set_ip6()

Message ID 20240507132717.627518-1-edumazet@google.com (mailing list archive)
State Accepted
Commit e2d09e5a1e8fb17a807dc4dce8dbc39d9fea3788
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: dst_cache: minor optimization in dst_cache_set_ip6() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 928 this patch: 928
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: dsahern@kernel.org
netdev/build_clang success Errors and warnings before: 938 this patch: 938
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 939 this patch: 939
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-05-08--03-00 (tests: 1005)

Commit Message

Eric Dumazet May 7, 2024, 1:27 p.m. UTC
There is no need to use this_cpu_ptr(dst_cache->cache) twice.

Compiler is unable to optimize the second call, because of
per-cpu constraints.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/core/dst_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Abeni May 7, 2024, 2:18 p.m. UTC | #1
On Tue, 2024-05-07 at 13:27 +0000, Eric Dumazet wrote:
> There is no need to use this_cpu_ptr(dst_cache->cache) twice.
> 
> Compiler is unable to optimize the second call, because of
> per-cpu constraints.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
>  net/core/dst_cache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/dst_cache.c b/net/core/dst_cache.c
> index f9df84a6c4b2dbe63c6f61fb431e179f92e072e0..6a0482e676d379f1f9bffdda51c7535243b3ec38 100644
> --- a/net/core/dst_cache.c
> +++ b/net/core/dst_cache.c
> @@ -112,7 +112,7 @@ void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst,
>  		return;
>  
>  	idst = this_cpu_ptr(dst_cache->cache);
> -	dst_cache_per_cpu_dst_set(this_cpu_ptr(dst_cache->cache), dst,
> +	dst_cache_per_cpu_dst_set(idst, dst,
>  				  rt6_get_cookie(dst_rt6_info(dst)));
>  	idst->in6_saddr = *saddr;
>  }

Acked-by: Paolo Abeni <pabeni@redhat.com>
patchwork-bot+netdevbpf@kernel.org May 9, 2024, 2 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  7 May 2024 13:27:17 +0000 you wrote:
> There is no need to use this_cpu_ptr(dst_cache->cache) twice.
> 
> Compiler is unable to optimize the second call, because of
> per-cpu constraints.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> 
> [...]

Here is the summary with links:
  - [net-next] net: dst_cache: minor optimization in dst_cache_set_ip6()
    https://git.kernel.org/netdev/net-next/c/e2d09e5a1e8f

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/core/dst_cache.c b/net/core/dst_cache.c
index f9df84a6c4b2dbe63c6f61fb431e179f92e072e0..6a0482e676d379f1f9bffdda51c7535243b3ec38 100644
--- a/net/core/dst_cache.c
+++ b/net/core/dst_cache.c
@@ -112,7 +112,7 @@  void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst,
 		return;
 
 	idst = this_cpu_ptr(dst_cache->cache);
-	dst_cache_per_cpu_dst_set(this_cpu_ptr(dst_cache->cache), dst,
+	dst_cache_per_cpu_dst_set(idst, dst,
 				  rt6_get_cookie(dst_rt6_info(dst)));
 	idst->in6_saddr = *saddr;
 }