netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Mika Penttilä" <mika.penttila@nextfour.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
	David Miller <davem@davemloft.net>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	Florian Westphal <fw@strlen.de>,
	netfilter-devel@vger.kernel.org, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH RFC] inetpeer: remove AVL implementation in favor of RB tree
Date: Wed, 5 Jul 2017 19:38:16 +0300	[thread overview]
Message-ID: <fc780727-897c-13c1-30f6-ab2e3f21f321@nextfour.com> (raw)
In-Reply-To: <1499270405.16045.8.camel@edumazet-glaptop3.roam.corp.google.com>

Hi!


On 05.07.2017 19:00, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> As discussed in Faro during Netfilter Workshop 2017, RB trees can be
> used with RCU, using a seqlock.
>
> Note that net/rxrpc/conn_service.c is already using this.
>
> This patch converts inetpeer from AVL tree to RB tree, since it allows
> to remove private AVL code in favor of shared RB code.
>
> $ size net/ipv4/inetpeer.before net/ipv4/inetpeer.after
>    text	   data	    bss	    dec	    hex	filename
>    3195	     40	    128	   3363	    d23	net/ipv4/inetpeer.before
>    1562	     24	      0	   1586	    632	net/ipv4/inetpeer.after
>
> The same technique can be used to speed up
> net/netfilter/nft_set_rbtree.c
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
>  
>  	return p;
> @@ -467,8 +231,9 @@ EXPORT_SYMBOL_GPL(inet_getpeer);
>  void inet_putpeer(struct inet_peer *p)
>  {
>  	p->dtime = (__u32)jiffies;
> -	smp_mb__before_atomic();
> -	refcount_dec(&p->refcnt);
> +
> +	if (refcount_dec_and_test(&p->refcnt))

Missing rb_erase() here...

> +		call_rcu(&p->rcu, inetpeer_free_rcu);
>  }
>  EXPORT_SYMBOL_GPL(inet_putpeer);
>  
>
--Mika



  reply	other threads:[~2017-07-05 16:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-05 16:00 [PATCH RFC] inetpeer: remove AVL implementation in favor of RB tree Eric Dumazet
2017-07-05 16:38 ` Mika Penttilä [this message]
     [not found]   ` <CAHTyZGz+vL0A9vJAuqFv88t1mZhgjSdZrX=n8_wCtOZfJBSA5A@mail.gmail.com>
2017-07-05 17:54     ` Mika Penttilä
2017-07-17  9:56 ` [PATCH net-next] " Eric Dumazet
2017-07-17 15:59   ` 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=fc780727-897c-13c1-30f6-ab2e3f21f321@nextfour.com \
    --to=mika.penttila@nextfour.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).