ipv6: Replace spinlock with seqlock and rcu in ip6_tunnel
This patch uses a seqlock to ensure consistency between idst->dst and idst->cookie. It also makes dst freeing from fib tree to undergo a rcu grace period. Signed-off-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
8e3d5be736
commit
70da5b5c53
@@ -155,6 +155,11 @@ static void node_free(struct fib6_node *fn)
|
||||
kmem_cache_free(fib6_node_kmem, fn);
|
||||
}
|
||||
|
||||
static void rt6_rcu_free(struct rt6_info *rt)
|
||||
{
|
||||
call_rcu(&rt->dst.rcu_head, dst_rcu_free);
|
||||
}
|
||||
|
||||
static void rt6_free_pcpu(struct rt6_info *non_pcpu_rt)
|
||||
{
|
||||
int cpu;
|
||||
@@ -169,7 +174,7 @@ static void rt6_free_pcpu(struct rt6_info *non_pcpu_rt)
|
||||
ppcpu_rt = per_cpu_ptr(non_pcpu_rt->rt6i_pcpu, cpu);
|
||||
pcpu_rt = *ppcpu_rt;
|
||||
if (pcpu_rt) {
|
||||
dst_free(&pcpu_rt->dst);
|
||||
rt6_rcu_free(pcpu_rt);
|
||||
*ppcpu_rt = NULL;
|
||||
}
|
||||
}
|
||||
@@ -181,7 +186,7 @@ static void rt6_release(struct rt6_info *rt)
|
||||
{
|
||||
if (atomic_dec_and_test(&rt->rt6i_ref)) {
|
||||
rt6_free_pcpu(rt);
|
||||
dst_free(&rt->dst);
|
||||
rt6_rcu_free(rt);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user