summaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_fib.c
diff options
context:
space:
mode:
authorWei Wang <weiwan@google.com>2017-06-17 10:42:36 -0700
committerDavid S. Miller <davem@davemloft.net>2017-06-17 22:54:00 -0400
commit587fea74113463b74e0d2994caf9e5f8045c28af (patch)
tree024bb5adfad7a6b1c6478f16af4153a657447903 /net/ipv6/ip6_fib.c
parentad65a2f05695aced349e308193c6e2a6b1d87112 (diff)
downloadlinux-587fea74113463b74e0d2994caf9e5f8045c28af.tar.gz
linux-587fea74113463b74e0d2994caf9e5f8045c28af.tar.bz2
linux-587fea74113463b74e0d2994caf9e5f8045c28af.zip
ipv6: mark DST_NOGC and remove the operation of dst_free()
With the previous preparation patches, we are ready to get rid of the dst gc operation in ipv6 code and release dst based on refcnt only. So this patch adds DST_NOGC flag for all IPv6 dst and remove the calls to dst_free() and its related functions. At this point, all dst created in ipv6 code do not use the dst gc anymore and will be destroyed at the point when refcnt drops to 0. Also, as icmp6 dst route is refcounted during creation and will be freed by user during its call of dst_release(), there is no need to add this dst to the icmp6 gc list as well. Instead, we need to add it into uncached list so that when a NETDEV_DOWN/NETDEV_UNREGISRER event comes, we can properly go through these icmp6 dst as well and release the net device properly. Signed-off-by: Wei Wang <weiwan@google.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_fib.c')
-rw-r--r--net/ipv6/ip6_fib.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 265401abb98e..e3b35e146eef 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -153,11 +153,6 @@ 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;
@@ -174,7 +169,6 @@ static void rt6_free_pcpu(struct rt6_info *non_pcpu_rt)
if (pcpu_rt) {
dst_dev_put(&pcpu_rt->dst);
dst_release(&pcpu_rt->dst);
- rt6_rcu_free(pcpu_rt);
*ppcpu_rt = NULL;
}
}
@@ -189,7 +183,6 @@ static void rt6_release(struct rt6_info *rt)
rt6_free_pcpu(rt);
dst_dev_put(&rt->dst);
dst_release(&rt->dst);
- rt6_rcu_free(rt);
}
}
@@ -1108,9 +1101,7 @@ out:
/* Always release dst as dst->__refcnt is guaranteed
* to be taken before entering this function
*/
- dst_release(&rt->dst);
- if (!(rt->dst.flags & DST_NOCACHE))
- dst_free(&rt->dst);
+ dst_release_immediate(&rt->dst);
}
return err;
@@ -1124,9 +1115,7 @@ st_failure:
/* Always release dst as dst->__refcnt is guaranteed
* to be taken before entering this function
*/
- dst_release(&rt->dst);
- if (!(rt->dst.flags & DST_NOCACHE))
- dst_free(&rt->dst);
+ dst_release_immediate(&rt->dst);
return err;
#endif
}