[<prev] [next>] [day] [month] [year] [list]
Message-ID: <9e86e8e1-4051-dd9d-8a21-32a28ef8d0d7@nextfour.com>
Date: Wed, 5 Jul 2017 20:54:47 +0300
From: Mika Penttilä <mika.penttila@...tfour.com>
To: ericnetdev dumazet <erdnetdev@...il.com>
Cc: netdev@...r.kernel.org, pablo neira ayuso <pablo@...filter.org>,
netfilter-devel@...r.kernel.org,
Eric Dumazet <eric.dumazet@...il.com>,
David Miller <davem@...emloft.net>,
Florian Westphal <fw@...len.de>
Subject: Re: [PATCH RFC] inetpeer: remove AVL implementation in favor of RB
tree
On 05.07.2017 19:48, ericnetdev dumazet wrote:
>
>
> On Jul 5, 2017 5:39 PM, "Mika Penttilä" <mika.penttila@...tfour.com <mailto:mika.penttila@...tfour.com>> wrote:
>
> Hi!
>
>
> On 05.07.2017 19:00, Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@...gle.com <mailto:edumazet@...gle.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@...gle.com <mailto:edumazet@...gle.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...
>
>
>
> I am pretty sure it is not missing. Have you tested your suggestion ? Thanks !
Sorry I missed the fact the tree holds one reference.
>
> > + call_rcu(&p->rcu, inetpeer_free_rcu);
> > }
> > EXPORT_SYMBOL_GPL(inet_putpeer);
> >
> >
> --Mika
>
>
>
Thanks,
Mika
Powered by blists - more mailing lists