perf report: Fix rbtree bug
Commit-ID: a4c43beaff0fe6c83aa2505dce8ffe65db8e0a33 Gitweb: http://git.kernel.org/tip/a4c43beaff0fe6c83aa2505dce8ffe65db8e0a33 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Wed, 3 Jun 2009 23:02:33 -0300 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 4 Jun 2009 09:27:21 +0200
perf report: Fix rbtree bug
Ingo Molnar reported:
Quoted 8 lines
FYI, i just got this crash (segfault) in perf report after collecting a long profile from Xorg:
Starting program:
/home/mingo/tip/Documentation/perf_counter/perfreport [Thread debugging usinglibthread_dbenabled]
Detaching after fork from child process 20008.
[New Thread0x7f92fd62a6f0(LWP 20005)]
Quoted 5 lines
Program received signal SIGSEGV, Segmentation fault.
0x000000000041031ain__rb_erase_color(node=0x142c090, parent=0x0, root=0x881918)at util/rbtree.c:143143 if (
parent->rb_left== node)
It was a problem introduced in this cset:
perf report: Fix comm sorting - 8229289b607682f90b946ad2c319526303c17700
This patch should fix it.
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
Acked-by Peter Zijlstra <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Marcelo Tosatti <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Stephane Eranian <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by Ingo Molnar <[email protected]>
--- Documentation/perf_counter/builtin-report.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
Documentation/perf_counter/builtin-report.c +5 -4
@@ -699,17 +699,18 @@ static void output__resort(void) {struct rb_node *next;struct hist_entry *n; +struct rb_root *tree = &hist;if (sort__need_collapse) - next =rb_first (&collapse_hists); -else - next =rb_first (&hist); + tree = &collapse_hists; + + next =rb_first (tree);while (next) { n = rb_entry(next, struct hist_entry, rb_node); next =rb_next (&n->rb_node); -rb_erase (&n->rb_node, &hist); +rb_erase (&n->rb_node, tree);output__insert_entry (n); } }