aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorMichal Kubeček <mkubecek@suse.cz>2013-08-01 04:04:14 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-01 17:16:20 -0400
commit2ac3ac8f86f2fe065d746d9a9abaca867adec577 (patch)
tree6d0513fcc4e048797a417174a667b7c562535ddb /net/ipv6/route.c
parent1f1059fcf0b30deb1cf1e23af9ef4231c0bcc0bb (diff)
ipv6: prevent fib6_run_gc() contention
On a high-traffic router with many processors and many IPv6 dst entries, soft lockup in fib6_run_gc() can occur when number of entries reaches gc_thresh. This happens because fib6_run_gc() uses fib6_gc_lock to allow only one thread to run the garbage collector but ip6_dst_gc() doesn't update net->ipv6.ip6_rt_last_gc until fib6_run_gc() returns. On a system with many entries, this can take some time so that in the meantime, other threads pass the tests in ip6_dst_gc() (ip6_rt_last_gc is still not updated) and wait for the lock. They then have to run the garbage collector one after another which blocks them for quite long. Resolve this by replacing special value ~0UL of expire parameter to fib6_run_gc() by explicit "force" parameter to choose between spin_lock_bh() and spin_trylock_bh() and call fib6_run_gc() with force=false if gc_thresh is reached but not max_size. Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index a8c891aa2464..824c424f9648 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1326,7 +1326,7 @@ static int ip6_dst_gc(struct dst_ops *ops)
1326 goto out; 1326 goto out;
1327 1327
1328 net->ipv6.ip6_rt_gc_expire++; 1328 net->ipv6.ip6_rt_gc_expire++;
1329 fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net); 1329 fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size);
1330 net->ipv6.ip6_rt_last_gc = now; 1330 net->ipv6.ip6_rt_last_gc = now;
1331 entries = dst_entries_get_slow(ops); 1331 entries = dst_entries_get_slow(ops);
1332 if (entries < ops->gc_thresh) 1332 if (entries < ops->gc_thresh)
@@ -2827,7 +2827,7 @@ int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write,
2827 net = (struct net *)ctl->extra1; 2827 net = (struct net *)ctl->extra1;
2828 delay = net->ipv6.sysctl.flush_delay; 2828 delay = net->ipv6.sysctl.flush_delay;
2829 proc_dointvec(ctl, write, buffer, lenp, ppos); 2829 proc_dointvec(ctl, write, buffer, lenp, ppos);
2830 fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net); 2830 fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0);
2831 return 0; 2831 return 0;
2832} 2832}
2833 2833