Skip to contentSkip to conversation

ipv6: use this_cpu_read() in rt6_get_pcpu_route()

PATCH Applied Eric Dumazet 2 participants 2 messages Jun 1, 2019 – Jun 3, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6: use this_cpu_read() in rt6_get_pcpu_route()

this_cpu_read(*X) is faster than *this_cpu_ptr(X)

---
 net/ipv6/route.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
net/ipv6/route.c +2 -3
index fada5a13bcb2a286bb20a350c1873b1b16dc866a..a72d01010cb6a734b2c4ee2dd865390d88e6a3b2 100644
@@ -1268,10 +1268,9 @@ static struct rt6_info *ip6_rt_pcpu_alloc(const struct fib6_result *res)
 /* It should be called with rcu_read_lock() acquired */
 static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res)
 {
-	struct rt6_info *pcpu_rt, **p;
+	struct rt6_info *pcpu_rt;
 
-	p = this_cpu_ptr(res->nh->rt6i_pcpu);
-	pcpu_rt = *p;
+	pcpu_rt = this_cpu_read(*res->nh->rt6i_pcpu);
 
 	if (pcpu_rt)
 		ip6_hold_safe(NULL, &pcpu_rt);
Signature · 1 line
2.22.0.rc1.257.g3120a18244-goog