summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/thread.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2019-08-08 22:12:01 +0200
committerThomas Gleixner <tglx@linutronix.de>2019-08-08 22:12:01 +0200
commitd7731b8133ad64cd98bf34a33dcf810df4410308 (patch)
tree20db6b86eaa8cb2106ab43709d5d43ada3bd4b6a /tools/perf/util/thread.c
parentb3c303be4c35856945cb17ec639b94637447dae2 (diff)
parent8e6e5bea2e34c61291d00cb3f47560341aa84bc3 (diff)
downloadtalos-op-linux-d7731b8133ad64cd98bf34a33dcf810df4410308.tar.gz
talos-op-linux-d7731b8133ad64cd98bf34a33dcf810df4410308.zip
Merge tag 'perf-urgent-for-mingo-5.3-20190808' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
perf/urgent fixes: db-export: Adrian Hunter: - Fix thread__exec_comm() picking of main thread COMM for pre-existing, synthesized from /proc data records. annotate: Arnaldo Carvalho de Melo: - Fix printing of unaugmented disassembled instructions from BPF, some lines were leaving leftovers from the previous screen, due to use of newlines by binutils's libopcode disassembler. perf ftrace: He Zhe: - Fix cpumask problems when only one CPU is present. PMU events: Jin Yao: - Add missing "cpu_clk_unhalted.core" event. perf bench: Jiri Olsa: - Fix cpu0 binding in the NUMA benchmarks. s390: Thomas Richter: - Fix module size calculations. build system: Masanari Iida: - Fix a typo in a variable name in the Documentation Makefile misc: Ian Rogers: - Fix include paths in ui directory. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/thread.c')
-rw-r--r--tools/perf/util/thread.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 873ab505ca80..590793cc5142 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -214,14 +214,24 @@ struct comm *thread__comm(const struct thread *thread)
struct comm *thread__exec_comm(const struct thread *thread)
{
- struct comm *comm, *last = NULL;
+ struct comm *comm, *last = NULL, *second_last = NULL;
list_for_each_entry(comm, &thread->comm_list, list) {
if (comm->exec)
return comm;
+ second_last = last;
last = comm;
}
+ /*
+ * 'last' with no start time might be the parent's comm of a synthesized
+ * thread (created by processing a synthesized fork event). For a main
+ * thread, that is very probably wrong. Prefer a later comm to avoid
+ * that case.
+ */
+ if (second_last && !last->start && thread->pid_ == thread->tid)
+ return second_last;
+
return last;
}
OpenPOWER on IntegriCloud