This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [RFC] [PATCH 2.6.37-rc5-tip 4/20] 4: uprobes: Adding and remove a uprobe in a rb tree.
- From: Srikar Dronamraju <srikar at linux dot vnet dot ibm dot com>
- To: Peter Zijlstra <peterz at infradead dot org>
- Cc: Ingo Molnar <mingo at elte dot hu>, Steven Rostedt <rostedt at goodmis 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>, Andi Kleen <andi at firstfloor dot org>, Oleg Nesterov <oleg at redhat dot com>, LKML <linux-kernel at vger dot kernel dot org>, SystemTap <systemtap at sources dot redhat dot com>, Linux-mm <linux-mm at kvack dot org>, Jim Keniston <jkenisto at linux dot vnet dot ibm dot com>, Frederic Weisbecker <fweisbec at gmail dot com>, Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>, Andrew Morton <akpm at linux-foundation dot org>, "Paul E. McKenney" <paulmck at linux dot vnet dot ibm dot com>
- Date: Wed, 26 Jan 2011 14:07:43 +0530
- Subject: Re: [RFC] [PATCH 2.6.37-rc5-tip 4/20] 4: uprobes: Adding and remove a uprobe in a rb tree.
- References: <20101216095714.23751.52601.sendpatchset@localhost6.localdomain6> <20101216095803.23751.41491.sendpatchset@localhost6.localdomain6> <1295957740.28776.718.camel@laptop>
- Reply-to: Srikar Dronamraju <srikar at linux dot vnet dot ibm dot com>
> > + spin_lock_irqsave(&treelock, flags);
> > + while (*p) {
> > + parent = *p;
> > + u = rb_entry(parent, struct uprobe, rb_node);
> > + if (u->inode > uprobe->inode)
> > + p = &(*p)->rb_left;
> > + else if (u->inode < uprobe->inode)
> > + p = &(*p)->rb_right;
> > + else {
> > + if (u->offset > uprobe->offset)
> > + p = &(*p)->rb_left;
> > + else if (u->offset < uprobe->offset)
> > + p = &(*p)->rb_right;
> > + else {
> > + atomic_inc(&u->ref);
>
> If the lookup can find a 'dead' entry, then why can't we here?
>
If a new user of a uprobe comes up as when the last registered user was
removing the uprobe, we keep the uprobe entry till the new user
loses interest in that uprobe.
> > + goto unlock_return;
> > + }
> > + }
> > + }
> > + u = NULL;
> > + rb_link_node(&uprobe->rb_node, parent, p);
> > + rb_insert_color(&uprobe->rb_node, &uprobes_tree);
> > + atomic_set(&uprobe->ref, 2);
> > +
> > +unlock_return:
> > + spin_unlock_irqrestore(&treelock, flags);
> > + return u;
> > +}
>
> It would be nice if you could merge the find and 'acquire' thing, the
> lookup is basically the same in both cases.
>
> Also, I'm not quite sure on the name of that last function, its not a
> strict insert and what's the trailing _rb_node about? That lookup isn't
> called find_uprobe_rb_node() either is it?
Since we already have a install_uprobe, register_uprobe, I thought
insert_uprobe_rb_node would give context to that function that it was
only inserting an rb_node but not installing the actual breakpoint.
I am okay to rename it to insert_uprobe().