diff options
author | Eric Dumazet <edumazet@google.com> | 2020-05-08 03:58:10 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-05-09 06:33:33 +0200 |
commit | cf86a086a18095e33e0637cb78cda1fcf5280852 (patch) | |
tree | c6d0569026ce134c625680f2946b9bbcdb8b0765 /net/ipv6/route.c | |
parent | net: relax SO_TXTIME CAP_NET_ADMIN check (diff) | |
download | linux-cf86a086a18095e33e0637cb78cda1fcf5280852.tar.xz linux-cf86a086a18095e33e0637cb78cda1fcf5280852.zip |
net/dst: use a smaller percpu_counter batch for dst entries accounting
percpu_counter_add() uses a default batch size which is quite big
on platforms with 256 cpus. (2*256 -> 512)
This means dst_entries_get_fast() can be off by +/- 2*(nr_cpus^2)
(131072 on servers with 256 cpus)
Reduce the batch size to something more reasonable, and
add logic to ip6_dst_gc() to call dst_entries_get_slow()
before calling the _very_ expensive fib6_run_gc() function.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 1ff142393c76..a9072dba00f4 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3195,6 +3195,9 @@ static int ip6_dst_gc(struct dst_ops *ops) int entries; entries = dst_entries_get_fast(ops); + if (entries > rt_max_size) + entries = dst_entries_get_slow(ops); + if (time_after(rt_last_gc + rt_min_interval, jiffies) && entries <= rt_max_size) goto out; |