From: Eric Dumazet <eric.dumazet@gmail.com>
To: Oliver Herms <oliver.peter.herms@gmail.com>, netdev@vger.kernel.org
Cc: davem@davemloft.net, kuznet@ms2.inr.ac.ru,
yoshfuji@linux-ipv6.org, kuba@kernel.org
Subject: Re: [PATCH] IPv6: Fix CPU contention on FIB6 GC
Date: Mon, 22 Jun 2020 15:55:21 -0700 [thread overview]
Message-ID: <32da6a56-0217-acda-c12c-49f7c74275ef@gmail.com> (raw)
In-Reply-To: <20200622205355.GA869719@tws>
On 6/22/20 1:53 PM, Oliver Herms wrote:
> When fib6_run_gc is called with parameter force=true the spinlock in
> /net/ipv6/ip6_fib.c:2310 can lock all CPUs in softirq when
> net.ipv6.route.max_size is exceeded (seen this multiple times).
> One sotirq/CPU get's the lock. All others spin to get it. It takes
> substantial time until all are done. Effectively it's a DOS vector.
>
> As the splinlock is only enforcing that there is at most one GC running
> at a time, it should IMHO be safe to use force=false here resulting
> in spin_trylock_bh instead of spin_lock_bh, thus avoiding the lock
> contention.
>
> Finding a locked spinlock means some GC is going on already so it is
> save to just skip another execution of the GC.
>
> Signed-off-by: Oliver Herms <oliver.peter.herms@gmail.com>
> ---
> net/ipv6/route.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 82cbb46a2a4f..7e6fbaf43549 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -3205,7 +3205,7 @@ static int ip6_dst_gc(struct dst_ops *ops)
> goto out;
>
> net->ipv6.ip6_rt_gc_expire++;
> - fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, true);
> + fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, false);
> entries = dst_entries_get_slow(ops);
> if (entries < ops->gc_thresh)
> net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1;
On which kernel have you seen a contention ?
I am asking this because I recently pushed a patch that basically should have
been enough to take care of the problem.
commit d8882935fcae28bceb5f6f56f09cded8d36d85e6
Author: Eric Dumazet <edumazet@google.com>
Date: Fri May 8 07:34:14 2020 -0700
ipv6: use DST_NOCOUNT in ip6_rt_pcpu_alloc()
next prev parent reply other threads:[~2020-06-22 22:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-22 20:53 [PATCH] IPv6: Fix CPU contention on FIB6 GC Oliver Herms
2020-06-22 21:44 ` Michal Kubecek
2020-06-22 22:46 ` Oliver Herms
2020-06-23 21:56 ` Michal Kubecek
2020-06-22 22:55 ` Eric Dumazet [this message]
2020-06-22 23:30 ` Oliver Herms
2020-06-23 22:06 ` Michal Kubecek
2020-06-24 10:34 ` Oliver Herms
2020-06-24 16:42 ` Eric Dumazet
2020-06-25 8:02 ` Oliver Herms
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=32da6a56-0217-acda-c12c-49f7c74275ef@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=oliver.peter.herms@gmail.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox