diff options
author | Jiri Olsa <jolsa@kernel.org> | 2015-11-02 06:10:25 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-11-05 10:51:00 -0500 |
commit | 0014de172d228e450377d1fd079d94e67128d27f (patch) | |
tree | 0a39934f9f5d9c383f7debd020e89c1efe6cb2b4 /tools/perf | |
parent | 98d3b258ede2cdac31a2728543f652964e597e79 (diff) |
perf sched latency: Fix thread pid reuse issue
The latency subcommand holds a tree of working atoms sorted by thread's
pid/tid. If there's new thread with same pid and tid, the old working atom is
found and assert bug condition is hit in search function:
thread_atoms_search: Assertion `!(thread != atoms->thread)' failed
Changing the sort function to use thread object pointers together with pid and
tid check. This way new thread will never find old one with same pid/tid.
Link: http://lkml.kernel.org/n/tip-o4doazhhv0zax5zshkg8hnys@git.kernel.org
Reported-by: Mohit Agrawal <moagrawa@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1446462625-15807-1-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-sched.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 0ee6d900e100..e3d3e32c0a93 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -1203,12 +1203,13 @@ static void output_lat_thread(struct perf_sched *sched, struct work_atoms *work_ | |||
1203 | 1203 | ||
1204 | static int pid_cmp(struct work_atoms *l, struct work_atoms *r) | 1204 | static int pid_cmp(struct work_atoms *l, struct work_atoms *r) |
1205 | { | 1205 | { |
1206 | if (l->thread == r->thread) | ||
1207 | return 0; | ||
1206 | if (l->thread->tid < r->thread->tid) | 1208 | if (l->thread->tid < r->thread->tid) |
1207 | return -1; | 1209 | return -1; |
1208 | if (l->thread->tid > r->thread->tid) | 1210 | if (l->thread->tid > r->thread->tid) |
1209 | return 1; | 1211 | return 1; |
1210 | 1212 | return (int)(l->thread - r->thread); | |
1211 | return 0; | ||
1212 | } | 1213 | } |
1213 | 1214 | ||
1214 | static int avg_cmp(struct work_atoms *l, struct work_atoms *r) | 1215 | static int avg_cmp(struct work_atoms *l, struct work_atoms *r) |