From 6a77f1dce6d434855c228d02e1235b3608cd8a88 Mon Sep 17 00:00:00 2001 From: Benjamin Thery Date: Tue, 4 Mar 2008 13:49:47 -0800 Subject: [PATCH] --- yaml --- r: 90025 b: refs/heads/master c: 6891a346c387bd0a64afa50f4522f5fe8ba879d8 h: refs/heads/master i: 90023: 6ba852ca66f20c28038b94b07e7979dc55d41980 v: v3 --- [refs] | 2 +- trunk/include/net/netns/ipv6.h | 2 ++ trunk/net/ipv6/route.c | 23 ++++++++++++----------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/[refs] b/[refs] index ebf6c97b758d..d264d4f248f7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f2fc6a54585a1be6669613a31fbaba2ecbadcd36 +refs/heads/master: 6891a346c387bd0a64afa50f4522f5fe8ba879d8 diff --git a/trunk/include/net/netns/ipv6.h b/trunk/include/net/netns/ipv6.h index 53b5a283a4b3..90e6e24df858 100644 --- a/trunk/include/net/netns/ipv6.h +++ b/trunk/include/net/netns/ipv6.h @@ -42,6 +42,8 @@ struct netns_ipv6 { struct hlist_head *fib_table_hash; struct fib6_table *fib6_main_tbl; struct dst_ops *ip6_dst_ops; + unsigned int ip6_rt_gc_expire; + unsigned long ip6_rt_last_gc; #ifdef CONFIG_IPV6_MULTIPLE_TABLES struct rt6_info *ip6_prohibit_entry; struct rt6_info *ip6_blk_hole_entry; diff --git a/trunk/net/ipv6/route.c b/trunk/net/ipv6/route.c index d88b6ec3c5d1..10a6cc0aca6c 100644 --- a/trunk/net/ipv6/route.c +++ b/trunk/net/ipv6/route.c @@ -992,23 +992,22 @@ int icmp6_dst_gc(int *more) static int ip6_dst_gc(struct dst_ops *ops) { - static unsigned expire = 30*HZ; - static unsigned long last_gc; + struct net *net = ops->dst_net; unsigned long now = jiffies; - if (time_after(last_gc + init_net.ipv6.sysctl.ip6_rt_gc_min_interval, now) && - atomic_read(&init_net.ipv6.ip6_dst_ops->entries) <= init_net.ipv6.sysctl.ip6_rt_max_size) + if (time_after(net->ipv6.ip6_rt_last_gc + net->ipv6.sysctl.ip6_rt_gc_min_interval, now) && + atomic_read(&net->ipv6.ip6_dst_ops->entries) <= net->ipv6.sysctl.ip6_rt_max_size) goto out; - expire++; - fib6_run_gc(expire, &init_net); - last_gc = now; - if (atomic_read(&init_net.ipv6.ip6_dst_ops->entries) < init_net.ipv6.ip6_dst_ops->gc_thresh) - expire = init_net.ipv6.sysctl.ip6_rt_gc_timeout>>1; + net->ipv6.ip6_rt_gc_expire++; + fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net); + net->ipv6.ip6_rt_last_gc = now; + if (atomic_read(&net->ipv6.ip6_dst_ops->entries) < net->ipv6.ip6_dst_ops->gc_thresh) + net->ipv6.ip6_rt_gc_expire = net->ipv6.sysctl.ip6_rt_gc_timeout>>1; out: - expire -= expire>>init_net.ipv6.sysctl.ip6_rt_gc_elasticity; - return (atomic_read(&init_net.ipv6.ip6_dst_ops->entries) > init_net.ipv6.sysctl.ip6_rt_max_size); + net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>net->ipv6.sysctl.ip6_rt_gc_elasticity; + return (atomic_read(&net->ipv6.ip6_dst_ops->entries) > net->ipv6.sysctl.ip6_rt_max_size); } /* Clean host part of a prefix. Not necessary in radix tree, @@ -2615,6 +2614,8 @@ static int ip6_route_net_init(struct net *net) proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops); proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops); #endif + net->ipv6.ip6_rt_gc_expire = 30*HZ; + ret = 0; out: return ret;