From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: brouer@redhat.com, pablo@netfilter.org,
netfilter-devel@vger.kernel.org, Florian Westphal <fw@strlen.de>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] netfilter: nf_conntrack: use safer way to lock all buckets
Date: Fri, 15 Jan 2016 08:06:53 +0100 [thread overview]
Message-ID: <20160115080653.137e0ad6@redhat.com> (raw)
In-Reply-To: <1452791036-2161-1-git-send-email-sasha.levin@oracle.com>
On Thu, 14 Jan 2016 12:03:56 -0500
Sasha Levin <sasha.levin@oracle.com> wrote:
> When we need to lock all buckets in the connection hashtable we'd attempt to
> lock 1024 spinlocks, which is way more preemption levels than supported by
> the kernel. Furthermore, this behavior was hidden by checking if lockdep is
> enabled, and if it was - use only 8 buckets(!).
>
> Fix this by using a global lock and synchronize all buckets on it when we
> need to lock them all. This is pretty heavyweight, but is only done when we
> need to resize the hashtable, and that doesn't happen often enough (or at all).
>
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
[...]
> diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
> index 3cb3cb8..4ccf5ad 100644
> --- a/net/netfilter/nf_conntrack_core.c
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -66,6 +66,21 @@ EXPORT_SYMBOL_GPL(nf_conntrack_locks);
> __cacheline_aligned_in_smp DEFINE_SPINLOCK(nf_conntrack_expect_lock);
> EXPORT_SYMBOL_GPL(nf_conntrack_expect_lock);
>
> +spinlock_t nf_conntrack_locks_all_lock;
> +bool nf_conntrack_locks_all;
You forgot to mark these static and __read_mostly as Florian pointed out...
After that you can add my:
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
Author of http://www.iptv-analyzer.org
LinkedIn: http://www.linkedin.com/in/brouer
prev parent reply other threads:[~2016-01-15 7:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-14 17:03 [PATCH v2] netfilter: nf_conntrack: use safer way to lock all buckets Sasha Levin
2016-01-14 17:25 ` Florian Westphal
2016-01-15 7:06 ` Jesper Dangaard Brouer [this message]
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=20160115080653.137e0ad6@redhat.com \
--to=brouer@redhat.com \
--cc=fw@strlen.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=sasha.levin@oracle.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.