]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ipv6: prevent fib6_run_gc() contention
authorMichal Kubeček <mkubecek@suse.cz>
Thu, 1 Aug 2013 08:04:14 +0000 (10:04 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Aug 2013 21:16:20 +0000 (14:16 -0700)
commit2ac3ac8f86f2fe065d746d9a9abaca867adec577
tree6d0513fcc4e048797a417174a667b7c562535ddb
parent1f1059fcf0b30deb1cf1e23af9ef4231c0bcc0bb
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>
include/net/ip6_fib.h
net/ipv6/ip6_fib.c
net/ipv6/ndisc.c
net/ipv6/route.c