This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH v2 2.6.38-rc8-tip 4/20] 4: uprobes: Adding and remove a uprobe in a rb tree.
- From: Peter Zijlstra <peterz at infradead dot org>
- To: Eric Dumazet <eric dot dumazet at gmail dot com>
- Cc: Thomas Gleixner <tglx at linutronix dot de>, Srikar Dronamraju <srikar at linux dot vnet dot ibm dot com>, Ingo Molnar <mingo at elte dot hu>, Steven Rostedt <rostedt at goodmis dot org>, Linux-mm <linux-mm at kvack dot org>, Arnaldo Carvalho de Melo <acme at infradead dot org>, Linus Torvalds <torvalds at linux-foundation dot org>, Masami Hiramatsu <masami dot hiramatsu dot pt at hitachi dot com>, Christoph Hellwig <hch at infradead dot org>, Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>, Andi Kleen <andi at firstfloor dot org>, Oleg Nesterov <oleg at redhat dot com>, Andrew Morton <akpm at linux-foundation dot org>, Jim Keniston <jkenisto at linux dot vnet dot ibm dot com>, Roland McGrath <roland at hack dot frob dot com>, SystemTap <systemtap at sources dot redhat dot com>, LKML <linux-kernel at vger dot kernel dot org>, "Paul E. McKenney" <paulmck at linux dot vnet dot ibm dot com>
- Date: Wed, 16 Mar 2011 08:54:27 +0100
- Subject: Re: [PATCH v2 2.6.38-rc8-tip 4/20] 4: uprobes: Adding and remove a uprobe in a rb tree.
- References: <20110314133403.27435.7901.sendpatchset@localhost6.localdomain6> <20110314133444.27435.50684.sendpatchset@localhost6.localdomain6> <alpine.LFD.2.00.1103151425060.2787@localhost6.localdomain6> <20110315173041.GB24254@linux.vnet.ibm.com> <alpine.LFD.2.00.1103151916120.2787@localhost6.localdomain6> <1300218499.2250.12.camel@laptop> <1300228944.2565.19.camel@edumazet-laptop>
On Tue, 2011-03-15 at 23:42 +0100, Eric Dumazet wrote:
> Le mardi 15 mars 2011 Ã 20:48 +0100, Peter Zijlstra a Ãcrit :
> > On Tue, 2011-03-15 at 20:22 +0100, Thomas Gleixner wrote:
> > > I am not sure if its a good idea to walk the tree
> > > > as and when the tree is changing either because of a insertion or
> > > > deletion of a probe.
> > >
> > > I know that you cannot walk the tree lockless except you would use
> > > some rcu based container for your probes.
> >
> > You can in fact combine a seqlock, rb-trees and RCU to do lockless
> > walks.
> >
> > https://lkml.org/lkml/2010/10/20/160
> >
> > and
> >
> > https://lkml.org/lkml/2010/10/20/437
> >
> > But doing that would be an optimization best done once we get all this
> > working nicely.
> >
>
> We have such schem in net/ipv4/inetpeer.c function inet_getpeer() (using
> a seqlock on latest net-next-2.6 tree), but we added a counter to make
> sure a reader could not enter an infinite loop while traversing tree
Right, Linus suggested a single lockless iteration, but a limited count
works too.
> (AVL tree in inetpeer case).
Ooh, there's an AVL implementation in the kernel? I have to ask, why not
use the RB-tree? (I know AVL has a slightly stronger balancing condition
which reduces the max depth from 2*log(n) to 1+log(n)).
Also, if it does make sense to have both and AVL and RB implementation,
does it then also make sense to lift the AVL thing to generic code into
lib/ ?