Skip to contentSkip to conversation

ipv4: Get peer more cheaply in rt_init_metrics().

PATCH In review David Miller 2 participants 2 messages Mar 5, 2011

Subsystems (3)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 1/1 ipv4: Get peer more cheaply in rt_init_metrics().

We know this is a new route object, so doing atomics and stuff makes no sense at all.

---
 net/ipv4/route.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/route.c +2 -2
index 6c87403..9794a2c 100644
@@ -1759,9 +1759,9 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
 	if (rt->fl.flags & FLOWI_FLAG_PRECOW_METRICS)
 		create = 1;
 
-	rt_bind_peer(rt, create);
-	peer = rt->peer;
+	rt->peer = peer = inet_getpeer_v4(rt->rt_dst, create);
 	if (peer) {
+		rt->rt_peer_genid = rt_peer_genid();
 		if (inet_metrics_new(peer))
 			memcpy(peer->metrics, fi->fib_metrics,
 			       sizeof(u32) * RTAX_MAX);
Signature · 1 line
1.7.4.1
Reviewed-by on v1 1/1
#1 lore raw

Le vendredi 04 mars 2011 à 21:26 -0800, David Miller écrit :

Quoted 14 lines

We know this is a new route object, so doing atomics and stuff makes no sense at all.

---
 net/ipv4/route.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/route.c +0 -0
index 6c87403..9794a2c 100644
@@ -1759,9 +1759,9 @@ static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
 	if (rt->fl.flags & FLOWI_FLAG_PRECOW_METRICS)

net/ipv4/route.c static void rt_init_metrics(struct rtable *rt, struct fib_info *fi) · line 1767

Quoted 10 lines
net/ipv4/route.c +2 -2
 		create = 1;
 
-	rt_bind_peer(rt, create);
-	peer = rt->peer;
+	rt->peer = peer = inet_getpeer_v4(rt->rt_dst, create);
 	if (peer) {
+		rt->rt_peer_genid = rt_peer_genid();
 		if (inet_metrics_new(peer))
 			memcpy(peer->metrics, fi->fib_metrics,
 			       sizeof(u32) * RTAX_MAX);