From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next] netfilter: nft_set_rbtree: use seqcount to avoid lock in most cases
Date: Wed, 26 Jul 2017 13:15:06 +0200 [thread overview]
Message-ID: <20170726111506.GA1816@salvia> (raw)
In-Reply-To: <20170726000941.29673-1-fw@strlen.de>
On Wed, Jul 26, 2017 at 02:09:41AM +0200, Florian Westphal wrote:
[...]
> @@ -144,7 +159,9 @@ static int nft_rbtree_insert(const struct net *net, const struct nft_set *set,
> int err;
>
> write_lock_bh(&priv->lock);
> + write_seqcount_begin(&priv->count);
> err = __nft_rbtree_insert(net, set, rbe, ext);
> + write_seqcount_end(&priv->count);
> write_unlock_bh(&priv->lock);
>
> return err;
> @@ -158,7 +175,9 @@ static void nft_rbtree_remove(const struct net *net,
> struct nft_rbtree_elem *rbe = elem->priv;
>
> write_lock_bh(&priv->lock);
Do we need the spinlock anymore? This is protected by mutex from
userspace, and we have no support for neither timeouts nor dynamic set
population from packet path yet.
> + write_seqcount_begin(&priv->count);
> rb_erase(&rbe->node, &priv->root);
> + write_seqcount_end(&priv->count);
> write_unlock_bh(&priv->lock);
> }
>
next prev parent reply other threads:[~2017-07-26 11:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-26 0:09 [PATCH nf-next] netfilter: nft_set_rbtree: use seqcount to avoid lock in most cases Florian Westphal
2017-07-26 10:34 ` Eric Dumazet
2017-07-26 11:04 ` Florian Westphal
2017-07-26 11:15 ` Pablo Neira Ayuso [this message]
2017-07-26 11:25 ` Pablo Neira Ayuso
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=20170726111506.GA1816@salvia \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).