net: dst_cache: minor optimization in dst_cache_set_ip6()
Subsystems (2)
PATCH 1/1 net: dst_cache: minor optimization in dst_cache_set_ip6()
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.
--- net/core/dst_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dst_cache.c +1 -1
@@ -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; }
Signature · 1 line
2.45.0.rc1.225.g2a3ae87e7f-goog
Quoted 15 lines · Eric Dumazet
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 <[email protected]>--- net/core/dst_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/core/dst_cache.c +0
-0
net/core/dst_cache.c void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst, · line 118
Quoted 8 lines
net/core/dst_cache.c +1
-1@@ -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; }
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · 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 <[email protected]>[...]
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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html