mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
perf sched timehist: Handle zero sample->tid properly
Sometimes samples have tid of 0 but non-0 pid. It ends up having a new thread of 0 tid/pid (instead of referring idle task) since tid is used to search matching task. But I guess it's wrong to use 0 as a tid when pid is set. This patch uses tid only if it has a non-zero value or same as pid (of 0). Signed-off-by: Namhyung Kim <[email protected]> Cc: Andi Kleen <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
571f1eb9b9
commit
5d92d96a94
1 changed files with 3 additions and 1 deletions
|
|
@ -2118,7 +2118,9 @@ static struct thread *timehist_get_thread(struct perf_sched *sched,
|
|||
pr_err("Failed to get idle thread for cpu %d.\n", sample->cpu);
|
||||
|
||||
} else {
|
||||
thread = machine__findnew_thread(machine, sample->pid, sample->tid);
|
||||
/* there were samples with tid 0 but non-zero pid */
|
||||
thread = machine__findnew_thread(machine, sample->pid,
|
||||
sample->tid ?: sample->pid);
|
||||
if (thread == NULL) {
|
||||
pr_debug("Failed to get thread for tid %d. skipping sample.\n",
|
||||
sample->tid);
|
||||
|
|
|
|||
Loading…
Reference in a new issue