[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1243360582.23657.23.camel@twins>
Date: Tue, 26 May 2009 19:56:22 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Ingo Molnar <mingo@...e.hu>, hpa@...or.com, paulus@...ba.org,
linux-kernel@...r.kernel.org, jkacur@...hat.com, efault@....de,
mtosatti@...hat.com, Thomas Gleixner <tglx@...utronix.de>,
cjashfor@...ux.vnet.ibm.com
Subject: Re: [PATCH 1/1 tip] perf: Don't assume /proc/kallsyms is ordered
On Tue, 2009-05-26 at 12:21 -0300, Arnaldo Carvalho de Melo wrote:
> Please fix the previous fix with this:
You don't need a second walk through the RB-tree like that, simply
change the lookup function:
The below finds the first entry that has ->start > ip, we then walk
backwards until we find an entry that has start <= ip < end and end > ip
(should never be more than 1).
This way you can deal with holes (like userspace has), and deal with
entries without size (like kallsyms) by setting size to a random large
value.
---
Index: linux-2.6/Documentation/perf_counter/builtin-report.c
===================================================================
--- linux-2.6.orig/Documentation/perf_counter/builtin-report.c
+++ linux-2.6/Documentation/perf_counter/builtin-report.c
@@ -147,16 +147,25 @@ static struct symbol *dso__find_symbol(s
return NULL;
struct rb_node *n = self->syms.rb_node;
+ struct rb_node *last = NULL;
+ struct symbol *s;
while (n) {
- struct symbol *s = rb_entry(n, struct symbol, rb_node);
+ last = n;
+ s = rb_entry(n, struct symbol, rb_node);
if (ip < s->start)
n = n->rb_left;
- else if (ip > s->end)
- n = n->rb_right;
else
+ n = n->rb_right;
+ }
+
+ while (last) {
+ s = rb_entry(last, struct symbol, rb_node);
+ if (s->start <= ip && ip < s->end)
return s;
+
+ last = rb_prev(last);
}
return NULL;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists