Skip to content

Commit 8d6c31b

Browse files
iamkafaidavem330
authored andcommitted
ipv6: Avoid rt6_probe() taking writer lock in the fast path
The patch checks neigh->nud_state before acquiring the writer lock. Note that rt6_probe() is only used in CONFIG_IPV6_ROUTER_PREF. 40 udpflood processes and a /64 gateway route are used. The gateway has NUD_PERMANENT. Each of them is run for 30s. At the end, the total number of finished sendto(): Before: 55M After: 95M Signed-off-by: Martin KaFai Lau <kafai@fb.com> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org> CC: Julian Anastasov <ja@ssi.bg> CC: YOSHIFUJI Hideaki <hideaki.yoshifuji@miraclelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 990edb4 commit 8d6c31b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/ipv6/route.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,9 @@ static void rt6_probe(struct rt6_info *rt)
560560
rcu_read_lock_bh();
561561
neigh = __ipv6_neigh_lookup_noref(rt->dst.dev, &rt->rt6i_gateway);
562562
if (neigh) {
563+
if (neigh->nud_state & NUD_VALID)
564+
goto out;
565+
563566
work = NULL;
564567
write_lock(&neigh->lock);
565568
if (!(neigh->nud_state & NUD_VALID) &&
@@ -583,6 +586,7 @@ static void rt6_probe(struct rt6_info *rt)
583586
schedule_work(&work->work);
584587
}
585588

589+
out:
586590
rcu_read_unlock_bh();
587591
}
588592
#else

0 commit comments

Comments
 (0)