[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-b25756df5b28cd7b6e91200fc5012e7c76e8ec69@git.kernel.org>
Date: Thu, 3 Jan 2019 05:26:27 -0800
From: tip-bot for Adrian Hunter <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, adrian.hunter@...el.com,
jolsa@...nel.org, acme@...hat.com, tglx@...utronix.de,
mingo@...nel.org, hpa@...or.com
Subject: [tip:perf/urgent] perf session: Add comment for
perf_session__register_idle_thread()
Commit-ID: b25756df5b28cd7b6e91200fc5012e7c76e8ec69
Gitweb: https://git.kernel.org/tip/b25756df5b28cd7b6e91200fc5012e7c76e8ec69
Author: Adrian Hunter <adrian.hunter@...el.com>
AuthorDate: Fri, 21 Dec 2018 14:06:20 +0200
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 2 Jan 2019 11:05:06 -0300
perf session: Add comment for perf_session__register_idle_thread()
Add a comment to perf_session__register_idle_thread() to bring attention to
a pitfall with the idle task thread structure. The pitfall is that there
should really be a 'struct thread' for the idle task of each cpu, but there
is only one that can have pid == tid == 0.
Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
Acked-by: Jiri Olsa <jolsa@...nel.org>
Link: http://lkml.kernel.org/r/20181221120620.9659-9-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/session.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 78a067777144..5456c84c7dd1 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1527,6 +1527,13 @@ struct thread *perf_session__findnew(struct perf_session *session, pid_t pid)
return machine__findnew_thread(&session->machines.host, -1, pid);
}
+/*
+ * Threads are identified by pid and tid, and the idle task has pid == tid == 0.
+ * So here a single thread is created for that, but actually there is a separate
+ * idle task per cpu, so there should be one 'struct thread' per cpu, but there
+ * is only 1. That causes problems for some tools, requiring workarounds. For
+ * example get_idle_thread() in builtin-sched.c, or thread_stack__per_cpu().
+ */
int perf_session__register_idle_thread(struct perf_session *session)
{
struct thread *thread;
Powered by blists - more mailing lists