Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1536639

[PATCH 03/10] perf sched timehist: Handle zero sample->tid properly

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 03/10] perf sched timehist: Handle zero sample->tid properly
Date 2016-12-06 04:50 +0100
Message-ID <sLeVs-55B-23@gated-at.bofh.it> (permalink)
References <sLeVr-55B-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <namhyung@kernel.org>
---
 tools/perf/builtin-sched.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 6991686bcaa5..e34a71166b4a 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -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);
-- 
2.10.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 03/10] perf sched timehist: Handle zero sample->tid properly Namhyung Kim <namhyung@kernel.org> - 2016-12-06 04:50 +0100
  Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid  properly David Ahern <dsahern@gmail.com> - 2016-12-06 05:00 +0100
    Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid properly Namhyung Kim <namhyung@kernel.org> - 2016-12-06 05:10 +0100
      Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid  properly David Ahern <dsahern@gmail.com> - 2016-12-06 05:10 +0100
    Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid  properly Namhyung Kim <namhyung@kernel.org> - 2016-12-07 03:30 +0100
      Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid  properly Namhyung Kim <namhyung@kernel.org> - 2016-12-08 15:30 +0100
  [tip:perf/core] perf sched timehist: Handle zero sample->tid  properly tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-12-07 19:30 +0100

csiph-web