summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2024-01-12 16:53:06 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-15 18:23:44 +0100
commit9635bd0a5296e2e725c6b33e530d0ef582e2f64e (patch)
tree4960e19de1a54ff1016737445e7fcba809da32d6 /net/core
parent47468fae2704151503214f4d4327c164118247fd (diff)
downloadlinux-stable-9635bd0a5296e2e725c6b33e530d0ef582e2f64e.tar.gz
linux-stable-9635bd0a5296e2e725c6b33e530d0ef582e2f64e.tar.bz2
linux-stable-9635bd0a5296e2e725c6b33e530d0ef582e2f64e.zip
net/dst: use a smaller percpu_counter batch for dst entries accounting
commit cf86a086a18095e33e0637cb78cda1fcf5280852 upstream. 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> Signed-off-by: Suraj Jitindar Singh <surajjs@amazon.com> Cc: <stable@vger.kernel.org> # 4.19.x Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dst.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/core/dst.c b/net/core/dst.c
index a263309df115..1a9f84f8cde1 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -97,11 +97,11 @@ void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
{
struct dst_entry *dst;
- if (ops->gc && dst_entries_get_fast(ops) > ops->gc_thresh) {
+ if (ops->gc &&
+ !(flags & DST_NOCOUNT) &&
+ dst_entries_get_fast(ops) > ops->gc_thresh) {
if (ops->gc(ops)) {
- printk_ratelimited(KERN_NOTICE "Route cache is full: "
- "consider increasing sysctl "
- "net.ipv[4|6].route.max_size.\n");
+ pr_notice_ratelimited("Route cache is full: consider increasing sysctl net.ipv6.route.max_size.\n");
return NULL;
}
}