netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net,
	netdev@vger.kernel.org
Subject: Re: [PATCH 2/5] netfilter: nft_rbtree: no need for spinlock from set destroy path
Date: Tue, 23 Sep 2014 18:10:40 +0200	[thread overview]
Message-ID: <20140923161040.GA3609@salvia> (raw)
In-Reply-To: <1411473245.26859.188.camel@edumazet-glaptop2.roam.corp.google.com>

On Tue, Sep 23, 2014 at 04:54:05AM -0700, Eric Dumazet wrote:
> On Tue, 2014-09-23 at 13:01 +0200, Pablo Neira Ayuso wrote:
> 
> > I'll send a follow up patch for nf-next to use rb_first() in that
> > patch. Thanks Eric.
> 
> I did a test, and its indeed a bit faster to use rb_first(), by about 5%
> 
> Real win is to be able to build a chain using rb_first()/rb_next(),
> (leaving the tree as is), then deleting the items in the chain, and
> simply reset rb_root.
> 
> This only needs to reuse one pointer to store the item->next pointer.
> 
> This is then about ~50% faster, because we do not constantly rebalance
> tree for every removed item.

Indeed.

struct nft_rbtree_elem {
        struct rb_node          node;
        u16                     flags;
        struct nft_data         key;
        struct nft_data         data[];
};

Actually, I could add to nft_data a pointer in the union area, but I'm
not very confortable with adding it for this specific case. At this
moment we're releasing this from rcu_callback which is "hiding" the
deletion time from the netlink interface.

But I'll keep this back in my head if we later on have some pointer
candidate to be reused in a nice way.

I'll send a patch to make the rb_first()/rb_next() conversion though.

Thanks for your comments!

  reply	other threads:[~2014-09-23 16:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23  9:24 [PATCH 0/5] nf pull request for net Pablo Neira Ayuso
2014-09-23  9:24 ` [PATCH 1/5] netfilter: nft_hash: no need for rcu in the hash set destroy path Pablo Neira Ayuso
2014-09-23  9:24 ` [PATCH 2/5] netfilter: nft_rbtree: no need for spinlock from " Pablo Neira Ayuso
2014-09-23  9:52   ` Eric Dumazet
2014-09-23 11:01     ` Pablo Neira Ayuso
2014-09-23 11:54       ` Eric Dumazet
2014-09-23 16:10         ` Pablo Neira Ayuso [this message]
2014-09-23 16:29           ` Eric Dumazet
2014-09-23  9:24 ` [PATCH 3/5] rhashtable: fix lockdep splat in rhashtable_destroy() Pablo Neira Ayuso
2014-09-23  9:24 ` [PATCH 4/5] netfilter: nfnetlink: deliver netlink errors on batch completion Pablo Neira Ayuso
2014-09-23  9:24 ` [PATCH 5/5] netfilter: xt_TPROXY: undefined reference to `udp6_lib_lookup' Pablo Neira Ayuso
2014-09-26 20:21 ` [PATCH 0/5] nf pull request for net David Miller

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=20140923161040.GA3609@salvia \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --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).