From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
Linux-mm <linux-mm@kvack.org>,
Arnaldo Carvalho de Melo <acme@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Christoph Hellwig <hch@infradead.org>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Oleg Nesterov <oleg@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
SystemTap <systemtap@sources.redhat.com>,
Jim Keniston <jkenisto@linux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Andi Kleen <andi@firstfloor.org>,
Andrew Morton <akpm@linux-foundation.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: Re: [RFC] [PATCH 2.6.37-rc5-tip 8/20] 8: uprobes: mmap and fork hooks.
Date: Wed, 26 Jan 2011 20:39:46 +0530 [thread overview]
Message-ID: <20110126150946.GK19725@linux.vnet.ibm.com> (raw)
In-Reply-To: <1295957741.28776.719.camel@laptop>
* Peter Zijlstra <peterz@infradead.org> [2011-01-25 13:15:41]:
> On Thu, 2010-12-16 at 15:28 +0530, Srikar Dronamraju wrote:
> > +static void search_within_subtree(struct rb_node *n, struct inode *inode,
> > + struct list_head *tmp_list);
> > +
> > +static void add_to_temp_list(struct vm_area_struct *vma, struct inode *inode,
> > + struct list_head *tmp_list)
> > +{
> > + struct uprobe *uprobe;
> > + struct rb_node *n;
> > + unsigned long flags;
> > +
> > + n = uprobes_tree.rb_node;
> > + spin_lock_irqsave(&treelock, flags);
> > + while (n) {
> > + uprobe = rb_entry(n, struct uprobe, rb_node);
> > + if (match_inode(uprobe, inode, &n)) {
> > + list_add(&uprobe->pending_list, tmp_list);
> > + search_within_subtree(n, inode, tmp_list);
> > + break;
> > + }
> > + }
> > + spin_unlock_irqrestore(&treelock, flags);
> > +}
> > +
> > +static void __search_within_subtree(struct rb_node *p, struct inode *inode,
> > + struct list_head *tmp_list)
> > +{
> > + struct uprobe *uprobe;
> > +
> > + uprobe = rb_entry(p, struct uprobe, rb_node);
> > + if (match_inode(uprobe, inode, &p)) {
> > + list_add(&uprobe->pending_list, tmp_list);
> > + search_within_subtree(p, inode, tmp_list);
> > + }
> > +
> > +
> > +}
> > +
> > +static void search_within_subtree(struct rb_node *n, struct inode *inode,
> > + struct list_head *tmp_list)
> > +{
> > + struct rb_node *p;
> > +
> > + if (p)
> > + __search_within_subtree(p, inode, tmp_list);
> > +
> > + p = n->rb_right;
> > + if (p)
> > + __search_within_subtree(p, inode, tmp_list);
> > +}
>
> Whee recursion FTW!, you just blew your kernel stack :-)
>
> Since you sort inode first, offset second, I think you can simply look
> for the first matching inode entry and simply rb_next() until you don't
> match.
Agree that we should get rid of recursion.
I dont think we can simply use rb_next() once we have the first
matching function. There could be a matching inode but a smaller
offset in left that will be missed by rb_next(). (Unless I have
misunderstood rb_next() !!!)
Here are the ways I think we can workaround.
A. change the match_inode() logic to use rb_first/rb_next.
This would make negate the benefit we get from rb_trees because we
have to match every node. Also match_offset might get a little tricky.
B. use the current match_inode but change the search_within_subtree
logic. search_within_subtree() would first find the leftmode node
within the subtree that still has the same inode. Thereafter it will use
rb_next().
Do you have any other ideas?
--
Thanks and Regards
Srikar
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-01-26 15:16 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20101216095714.23751.52601.sendpatchset@localhost6.localdomain6>
[not found] ` <20101216095817.23751.76989.sendpatchset@localhost6.localdomain6>
[not found] ` <1295957745.28776.723.camel@laptop>
2011-01-26 7:47 ` [RFC] [PATCH 2.6.37-rc5-tip 5/20] 5: Uprobes: register/unregister probes Srikar Dronamraju
2011-01-26 10:10 ` Peter Zijlstra
[not found] ` <1295957744.28776.722.camel@laptop>
2011-01-26 7:55 ` Srikar Dronamraju
2011-01-26 10:11 ` Peter Zijlstra
2011-01-26 15:30 ` Srikar Dronamraju
2011-01-26 15:45 ` Peter Zijlstra
2011-01-26 16:56 ` Srikar Dronamraju
2011-01-26 17:12 ` Peter Zijlstra
2011-01-27 10:01 ` Srikar Dronamraju
2011-01-27 10:23 ` Peter Zijlstra
2011-01-27 10:25 ` Srikar Dronamraju
2011-01-27 10:41 ` Peter Zijlstra
2011-01-27 10:29 ` Peter Zijlstra
[not found] ` <20101216095803.23751.41491.sendpatchset@localhost6.localdomain6>
[not found] ` <1295957740.28776.718.camel@laptop>
2011-01-26 8:37 ` [RFC] [PATCH 2.6.37-rc5-tip 4/20] 4: uprobes: Adding and remove a uprobe in a rb tree Srikar Dronamraju
[not found] ` <20101216095957.23751.57040.sendpatchset@localhost6.localdomain6>
[not found] ` <1295963779.28776.1059.camel@laptop>
2011-01-26 8:52 ` [RFC] [PATCH 2.6.37-rc5-tip 14/20] 14: uprobes: Handing int3 and singlestep exception Srikar Dronamraju
2011-01-26 10:17 ` Peter Zijlstra
2011-01-26 15:14 ` Srikar Dronamraju
2011-01-26 15:29 ` Peter Zijlstra
[not found] ` <20101216095848.23751.73144.sendpatchset@localhost6.localdomain6>
[not found] ` <1295957739.28776.717.camel@laptop>
2011-01-26 9:03 ` [RFC] [PATCH 2.6.37-rc5-tip 8/20] 8: uprobes: mmap and fork hooks Srikar Dronamraju
2011-01-26 10:20 ` Peter Zijlstra
2011-01-26 14:59 ` Srikar Dronamraju
2011-01-26 15:16 ` Peter Zijlstra
2011-01-26 16:30 ` Srikar Dronamraju
[not found] ` <1295957741.28776.719.camel@laptop>
2011-01-26 15:09 ` Srikar Dronamraju [this message]
2011-01-26 15:20 ` Peter Zijlstra
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=20110126150946.GK19725@linux.vnet.ibm.com \
--to=srikar@linux.vnet.ibm.com \
--cc=acme@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=ananth@in.ibm.com \
--cc=andi@firstfloor.org \
--cc=fweisbec@gmail.com \
--cc=hch@infradead.org \
--cc=jkenisto@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=systemtap@sources.redhat.com \
--cc=torvalds@linux-foundation.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).