aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/perf/util/thread.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2014-07-14 13:02:25 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-07-16 17:57:33 -0300
commit1fcb8768636d38cb6fdfeef83a5ee596c4bd9c56 (patch)
treeffefb332e8e0e035201fbe4b0f4cef9301ac76d1 /tools/perf/util/thread.c
parentperf script: Provide additional sample information on generic events (diff)
downloadwireguard-linux-1fcb8768636d38cb6fdfeef83a5ee596c4bd9c56.tar.xz
wireguard-linux-1fcb8768636d38cb6fdfeef83a5ee596c4bd9c56.zip
perf machine: Fix the value used for unknown pids
The value used for unknown pids cannot be zero because that is used by the "idle" task. Use -1 instead. Also handle the unknown pid case when creating map groups. Note that, threads with an unknown pid should not occur because fork (or synthesized) events precede the thread's existence. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1405332185-4050-2-git-send-email-adrian.hunter@intel.com 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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 2fde0d5e40b5..7a32f447a8e7 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -13,7 +13,7 @@ int thread__init_map_groups(struct thread *thread, struct machine *machine)
struct thread *leader;
pid_t pid = thread->pid_;
- if (pid == thread->tid) {
+ if (pid == thread->tid || pid == -1) {
thread->mg = map_groups__new();
} else {
leader = machine__findnew_thread(machine, pid, pid);