From 6485aae3ca859679d0742badd14b20f2cc922d23 Mon Sep 17 00:00:00 2001 From: Frederic Weisbecker Date: Thu, 8 Jul 2010 06:06:17 +0200 Subject: [PATCH] perf: Resurrect flat callchains commit 97aa1052739c6a06cb6b0467dbf410613d20bc97 upstream. Initialize the callchain radix tree root correctly. When we walk through the parents, we must stop after the root, but since it wasn't well initialized, its parent pointer was random. Also the number of hits was random because uninitialized, hence it was part of the callchain while the root doesn't contain anything. This fixes segfaults and percentages followed by empty callchains while running: perf report -g flat Reported-by: Ingo Molnar Signed-off-by: Frederic Weisbecker Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo Cc: Paul Mackerras Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/callchain.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index 43cf3ea9e088..a31a8cd67570 100644 --- a/tools/perf/util/callchain.h +++ b/tools/perf/util/callchain.h @@ -48,6 +48,9 @@ static inline void callchain_init(struct callchain_node *node) INIT_LIST_HEAD(&node->brothers); INIT_LIST_HEAD(&node->children); INIT_LIST_HEAD(&node->val); + + node->parent = NULL; + node->hit = 0; } static inline u64 cumul_hits(struct callchain_node *node) -- 2.39.5