Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90026
b: refs/heads/master
c: 7019b78
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Lezcano authored and David S. Miller committed Mar 4, 2008
1 parent 6a77f1d commit 112cdac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6891a346c387bd0a64afa50f4522f5fe8ba879d8
refs/heads/master: 7019b78e1483fa724dcba56e8465376b8fd03ea8
22 changes: 13 additions & 9 deletions trunk/net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,22 +992,26 @@ int icmp6_dst_gc(int *more)

static int ip6_dst_gc(struct dst_ops *ops)
{
struct net *net = ops->dst_net;
unsigned long now = jiffies;

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)
struct net *net = ops->dst_net;
int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval;
int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size;
int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity;
int rt_gc_timeout = net->ipv6.sysctl.ip6_rt_gc_timeout;
unsigned long rt_last_gc = net->ipv6.ip6_rt_last_gc;

if (time_after(rt_last_gc + rt_min_interval, now) &&
atomic_read(&ops->entries) <= rt_max_size)
goto out;

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;

if (atomic_read(&ops->entries) < ops->gc_thresh)
net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1;
out:
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);
net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>rt_elasticity;
return (atomic_read(&ops->entries) > rt_max_size);
}

/* Clean host part of a prefix. Not necessary in radix tree,
Expand Down

0 comments on commit 112cdac

Please sign in to comment.