Commit a4c43bea authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Ingo Molnar
Browse files

perf report: Fix rbtree bug

Ingo Molnar reported:

> 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/perf report
> [Thread debugging using libthread_db enabled]
> Detaching after fork from child process 20008.
> [New Thread 0x7f92fd62a6f0 (LWP 20005)]
> Program received signal SIGSEGV, Segmentation fault.
> 0x000000000041031a in __rb_erase_color (node=0x142c0901, parent=0x0,
> root=0x881918)
>     at util/rbtree.c:143
> 143			if (parent->rb_left == node)

It was a problem introduced in this cset:

 perf report: Fix comm sorting - 8229289b

This patch should fix it.
Signed-off-by: default avatarArnaldo Carvalho de Melo <>
Acked-by: default avatarPeter Zijlstra <>
Cc: Mike Galbraith <>
Cc: Paul Mackerras <>
Cc: Corey Ashford <>
Cc: Marcelo Tosatti <>
Cc: Arnaldo Carvalho de Melo <>
Cc: Thomas Gleixner <>
Cc: Stephane Eranian <>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <>
parent d11444df
......@@ -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);
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);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment