Skip to content

Commit

Permalink
Revert "ipv6: make ip6_rt_gc_expire an atomic_t"
Browse files Browse the repository at this point in the history
This reverts commit b4cfbea which is
commit 9cb7c013420f98fa6fd12fc6a5dc055170c108db upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: Idad46376e176f54a1d6781bdb432131bed7844f2
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
  • Loading branch information
gregkh committed Jan 16, 2024
1 parent 9aada1f commit f1d3306
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions include/net/netns/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ struct netns_ipv6 {
struct dst_ops ip6_dst_ops;
rwlock_t fib6_walker_lock;
spinlock_t fib6_gc_lock;
atomic_t ip6_rt_gc_expire;
unsigned long ip6_rt_last_gc;
unsigned int ip6_rt_gc_expire;
unsigned long ip6_rt_last_gc;
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
unsigned int fib6_rules_require_fldissect;
bool fib6_has_custom_rules;
Expand Down
11 changes: 5 additions & 6 deletions net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -2775,7 +2775,6 @@ static int ip6_dst_gc(struct dst_ops *ops)
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;
unsigned int val;
int entries;

entries = dst_entries_get_fast(ops);
Expand All @@ -2786,13 +2785,13 @@ static int ip6_dst_gc(struct dst_ops *ops)
entries <= rt_max_size)
goto out;

fib6_run_gc(atomic_inc_return(&net->ipv6.ip6_rt_gc_expire), net, true);
net->ipv6.ip6_rt_gc_expire++;
fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, true);
entries = dst_entries_get_slow(ops);
if (entries < ops->gc_thresh)
atomic_set(&net->ipv6.ip6_rt_gc_expire, rt_gc_timeout >> 1);
net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1;
out:
val = atomic_read(&net->ipv6.ip6_rt_gc_expire);
atomic_set(&net->ipv6.ip6_rt_gc_expire, val - (val >> rt_elasticity));
net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>rt_elasticity;
return entries > rt_max_size;
}

Expand Down Expand Up @@ -5321,7 +5320,7 @@ static int __net_init ip6_route_net_init(struct net *net)
net->ipv6.sysctl.ip6_rt_mtu_expires = 10*60*HZ;
net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40;

atomic_set(&net->ipv6.ip6_rt_gc_expire, 30*HZ);
net->ipv6.ip6_rt_gc_expire = 30*HZ;

ret = 0;
out:
Expand Down

0 comments on commit f1d3306

Please sign in to comment.